Docker - usefull commands for managing containers | DIMI’s place

DIMI's place

My thoughts on different things

24 January 2018

Docker - usefull commands for managing containers

Just a small set of Docker commands that I’m often using for images maintenance:

Override entry point for docker image

docker run --entrypoint=bash -it <image>

Clean unused containers & volumes

docker container prune --force; docker volume prune --force;

Remove All images that does not have tags

docker rmi $(docker images | grep "^<none>" | awk "{print $3}") -f

Troubleshooting:

/usr/lib/systemd/system/docker.service
ExecStart ... --insecure-registry <host>:<port>
sudo systemctl daemon-reload
sudo systemctl restart docker
entrypoint.sh: 18: entrypoint.sh: Syntax error: "(" unexpected (expecting "}")

Probably, the script was created in windows (in IDEA?) and has newline encoding set as CRLF, which causes linux to go crazy

Change encoding to LF (there is a button on the right bottom size of the page).

tags: docker - bash