My current understanding is that in order to change a running parameter of a Docker Container, the existing instance must be removed and a new one started. Here is how to do that.
First stop your container
https://www.google.com/search?q=docker+stop+container
https://docs.docker.com/engine/reference/commandline/stop/
Get your container ID using docker ps first and make sure its gone after stop completes
[root@homeserver hassconfig]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6a6554465733 homeassistant/home-assistant "python -m homeassis…" 18 minutes ago Up 18 minutes home-assistant ada565dd0a56 plexinc/pms-docker "/init" 7 weeks ago Up 2 weeks (healthy) 0.0.0.0:3005->3005/tcp, 0.0.0.0:8324->8324/tcp, 0.0.0.0:1900->1900/udp, 0.0.0.0:32410->32410/udp, 0.0.0.0:32400->32400/tcp, 0.0.0.0:32412-32414->32412-32414/udp, 0.0.0.0:32469->32469/tcp plex [root@homeserver hassconfig]# docker stop 6a6554465733 6a6554465733 [root@homeserver hassconfig]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ada565dd0a56 plexinc/pms-docker "/init" 7 weeks ago Up 2 weeks (healthy) 0.0.0.0:3005->3005/tcp, 0.0.0.0:8324->8324/tcp, 0.0.0.0:1900->1900/udp, 0.0.0.0:32410->32410/udp, 0.0.0.0:32400->32400/tcp, 0.0.0.0:32412-32414->32412-32414/udp, 0.0.0.0:32469->32469/tcp plex
Now my container is stopped i can remove it.
https://www.google.com/search?q=docker+remove
Gives me
https://zaiste.net/removing_docker_containers/
Thanks Zaiste!
I can verify the Container ID using ps
docker ps -aq -f status=exited
and then go ahead and remove it, verifying it has truly gone
[root@homeserver hassconfig]# docker ps -aq -f status=exited 6a6554465733 [root@homeserver hassconfig]# docker rm 6a6554465733 6a6554465733 [root@homeserver hassconfig]# docker ps -aq -f status=exited
(The last command above returns nothing as there are no longer any containers in a stopped state).
Easy when you know how 🙂
One thought on “How to remove a Docker Container on CentOS”
Comments are closed.