Docker is a open source platform to run and ship applications. For brief introduction about the docker. Dockers mainly contains images and containers. We can create any kind of containers in different way based on the images available. We can download images from hub.docker.com. If you want to know more about docker images and container This post mainly contains most frequently used docker commands to handle containers and images By running just docker in your terminal will list down all the executable commands
docker
We can always run docker command - help to get information about any command
docker create - name=demo -it ubuntu bash
Docker uses the technique image caching. If the image is new, it will download the image and cache it in our machine. To get more information about create
docker create - help
docker container ls
docker container ls -a
docker start demo
If you run the docker container ls now. You can see our running state of our docker
This command is the combination of create and start command
Example with options:
docker run - name=bar -it ubuntu bash
docker attach demo
This will open the docker container in your terminal. Ubuntu image which we used will only have minimal setup. We need to install all packages we needed.
docker logs demo
docker rm foo
#Force remove: docker rm foo -f
docker container ls -aq | xargs docker container rm
docker rmi b0dcbb03ed8d
# We can delete multiple docker image by
# stacking the image id/name one after another
docker rmi b0dcbb03ed8d 74ead862bbeb
docker image ls -aq | xargs docker rmi -f
Search for a docker image:
docker search ubuntu