The five most useful commands for the docker cli
IMHO there are five docker commands which you need to have a successful start in containerized application development:
Build an image of a Dockerfile:
docker build -t IMAGE_NAME .
Start a container for an image:
docker run --name CONTAINER_NAME IMAGE_NAME
Get and follow logs of the container.
docker logs -f CONTAINER_NAME
Execute a bash inside the container. Can be helpful for further introspection:
docker exec -it CONTAINER_NAME bash
Show all running containers.
docker ps
Anyone who has knowledge about other bash commands like grep or cat can use them in conjunction to be even more powerful.
Recently I have been using these commands at work and recognized that these are the commands which are used to handle containers for the most basic stuff.
That’s a good starting point to learn more about port mapping, inspection, layers, networking and all the other stuff which makes containerized applications fun.