Just published this article on key Docker commands for folks getting started. Constructive feedback appreciated.
[https://towardsdatascience.com/15-docker-commands-you-should-know-970ea5203421](https://towardsdatascience.com/15-docker-commands-you-should-know-970ea5203421)
docker kill doesnt delete the container, it just sends a sigkill to the process running inside
> `docker rmi $(docker images -a -q)`
I’ve used this one enough times to turn it into a shell script:
https://github.com/robloach/docker-clean
DESTROY DESTROY DESTROY!
I think it would be better if you use the [management commands](http://blog.arungupta.me/docker-1-13-management-commands/) instead of the legacy commands. For example, `docker container ls` instead of `docker ps`, and `docker image rm` instead of `docker rmi`.
The management commands provide a much more consistent and organized interface for all resources. I find new users do better with them because the resource they’re working with (e.g., container, image) is spelled out, and they can easily figure out what they can do with the resource (e.g., `docker container –help`). The legacy commands are in one flat list, and don’t comprehensively cover everything that you can do to resources.
You can hide the legacy commands by setting [`DOCKER_HIDE_LEGACY_COMMANDS`](https://docs.docker.com/engine/reference/commandline/cli/#environment-variables) in your shell.
“docker rm $(docker ps -a -q) — Delete all containers that are not running.”
I think this command also delete containers which are running + which are not running.
I think its really great you’re doing this! I work with research/data scientists, and so many of them have these great ideas, but are just really intimidated by the build and deploy process. I find that software engineers generally like to play with this kind of thing, so they are an easy sell, whereas research and data scientists could care less about what is happening if they aren’t playing with a model or munging data. They just want it off their laptops and out in the wild somewhere.
I’m constantly on the look out for resources to make docker (and deployment in general) more accessible for data scientists. So thanks! I will add this to my list of resources. 😉
I agree with the other commenters who suggested to add the prune, and the management commands. The management commands are new for me too!
Just one correction.
Docker build -t tag . The dot stands for where the Dockerfile used to build the image is located.
Say you have yours Dockerfile onto /foo/, you could use docker build -t tag /foo/
Cheers,