single command to stop and remove docker container

You can use :

docker rm -f CONTAINER_ID

It will remove the container even if it is still running.

https://docs.docker.com/engine/reference/commandline/rm/

You can also run your containers with --rm option (e.g. docker run --rm -it alpine), it will be automatically removed when stopped.

https://docs.docker.com/engine/reference/run/#clean-up—rm

Edit: The rm -f might be dangerous for your data and is best suited for test or development containers. @Bernard’s comment on this subject is worth reading.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)