Swipe left or right to navigate to next or previous post
Docker is the service that manages the container. It is based on the philosophy of develop, ship and run anywhere. The docker helps developers to easily develop applications, ship the applications into the containers that can be deployed everywhere.
sudo docker pull hello-world
This will pull the hello-world image from remote docker hub
docker run hello-world
This command is used to create an instance of the image which is also called a container
docker run -it hello-world /bin/bash
/bin/bash is used to run the bash shell once hello-world is up and running.
docker images
This command is used to display all the images currently installed in the system
It will display the following information
docker run hello-world
This command will download the hello-world image if the image is not present on the system and run the image as container
docker rmi imageId
This command will remove the image with the mentioned imageId
sudo docker images -q
This command will only show the image id of all the images in the system
sudo docker inspect hello-world
docker ps
docker ps -a
sudo docker stop containerId
This command will stop the container with the mentioned containerId
sudo docker rm containerId
This command will delete/remove the container with the mentioned containerId
sudo docker stats containerId
This command will provide CPU and memory utilization of the Container
sudo docker kill containerId
This command will kill the process running on the Container
sudo service docker stop
This command is used to stop the Docker daemon process.
sudo service docker start
This command is used to start the Docker daemon process.
docker build -t ImageName:TagName dir
This method allows the users to build own Docker images.
Options
Example:
sudo docker build –t myDockerImage:0.1 .
Here, myDockerImage is the image name and 0.1 is the tag number. The '.' at the end of the commands signify the present working directory.
sudo docker pull hello-world
This command is used to pull the hello-world from the remote docker repo.
docker tag imageID RepositoryName
This command allows to tag an image to mentioned repo
Example
sudo docker tag ab0c1d3744dd hello-world:1.0
sudo docker push RepositoryName
This command allows one to push images to the Docker Hub.
Example
sudo docker push hello-world:1.0