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
dockerWe can always run docker command - help to get information about any command
docker create - name=demo -it ubuntu bashDocker 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 - helpdocker container lsdocker container ls -adocker start demoIf 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 demoThis 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 demodocker rm foo
#Force remove: docker rm foo -fdocker 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 74ead862bbebdocker image ls -aq | xargs docker rmi -f
Search for a docker image:
docker search ubuntu