When you
try to remove a running container using ‘container rm’ command, you will get an
error like ‘You cannot remove a running container’.
$docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c468cd633430 jboss/wildfly "/opt/jboss/wildfly/…" 2 minutes ago Up 2 minutes 8080/tcp myWebApplication $ $docker container rm c468cd633430 Error response from daemon: You cannot remove a running container c468cd6334304c292ac15aacc77ff6476d9ef7cef6cbea570be6fb381fd720f2. Stop the container before attempting removal or force remove
Either you
can stop the container and delete or use ‘rm -f’ to delete the running
container.
$docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c468cd633430 jboss/wildfly "/opt/jboss/wildfly/…" 3 minutes ago Up 3 minutes 8080/tcp myWebApplication $ $docker container rm -f c468cd633430 c468cd633430 $ $docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $ $docker container ls -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $
No comments:
Post a Comment