Useful Docker Commands

The following are some useful docker commands that I haven’t yet committed to memory.

Delete all containers

$(echo docker ps -aq) | while read -r line; do docker rm "${line}"; done

WARNING: As with rm -rf on Linux, this action is not reversible. Take care when using this command.

docker system prune -a -f

Fix DNS issues on some Ubuntu 18.04 hosts

Problem: https://github.com/docker/libnetwork/issues/2187#issuecomment-403372190_

Solution (on the host): ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

comments powered by Disqus