I'm new to Docker and trying to set up NGINX as a reverse proxy for multiple services. I removed a few failed attempts and thought I understood the setup better. I have NGINX in its own container and defined a network in the YAML for it. However, when I checked running containers, the name is different from what I placed in the YAML file. It's named **nginx-proxy-manager-nginx-proxy-manager-1** instead of just **nginx-proxy-manager**. I'm also worried this might affect connecting additional containers. Here are both YAML snippets for clarity. Can anyone explain why I'm seeing this different container name?
2 Answers
Did you create the `nginx-proxy-network` manually? Since you've marked it as external in the YAML, Docker won't create it for you. This means your containers won't communicate. As for the long container name, don't worry too much; Docker Compose uses service names for DNS—so you can reference `nginx-proxy-manager` in your other configs, and it will work despite the longer default name.
Docker Compose names containers following a set pattern: `__`. By default, the project name is derived from the folder's name containing the Compose file. If you want a specific name, you can set it directly in the service definition using `container_name: `. Also, it's possible to change the default project name; check out Docker's documentation for that. The index will typically remain 1 unless you set replicas.
Thanks for the clarification! That makes a lot of sense.

Thanks for catching that! I didn't realize I had to manually run the network command. I'll get that sorted out. I appreciate the help!