Docker Community Forums

Share and learn in the Docker community.

Cannot bind an existing container to windows port


(Shababy) #1

Hi,

Currently I am trying to host a html file from my container and access it from my host machine. I downloaded nginx on my ubuntu container and configured it to host an html file on the localhost, port 80.

When I try to bind that port to windows using this command:

docker run -it -p [host port]:[containerport(80)] --name [container_name] [imagename(ubuntu)]

I receive this error:

Error response from daemon: Conflict. The container name "/test_container" is already in use by container "*****aab84a4d4fac9a47832a05fdedde7473c74ac8868750e173d6b********". You have to remove (or rename) that container to be able to reuse that name.

Is there a separate command for containers that already exist? I don’t want to create a new container I just want to bind my existing container’s port to my host machine ports so I can access my webpage from the host computers web browser.