Docker Community Forums

Share and learn in the Docker community.

How to Remove unnecessary ports and ip bonds from running container?


(Lp5pr) #1

6c88a970a112 ubuntu-image “bash” 45 hours ago Up 44 hours 1234/tcp, 12354/tcp, 1069/tcp, 19945/tcp, 51234/tcp, 41234/tcp, 31234/tcp, 23411/tcp, 2121/tcp, 141.16.22.15:1275->1275/tcp ubuntu-container-from-image

how to remove all ports but remain 141.16.22.15:1275->1275/tcp
I want nice looking

docker ps

like this

6c88a970a112 ubuntu-image “bash” 45 hours ago Up 44 hours 141.16.22.15:1275->1275/tcp ubuntu-container-from-image


(David Maze) #2

Stop, delete, and restart the container with the desired settings.

(There is no other way to do this, and this is one of a class of extremely routine things that require deleting and recreating a container. Updating the image a container is running is the even bigger one. Make sure you have your image build sequence and data storage set up so that this isn’t a problem.)


(Sam) #3

yeh. he has unused exports he wants to get rid of. on a running container… just not possible.

he can rebuild his image to not export them in the future