listed below are step-by-step directions on how best to pull Docker pictures from run and repository containers using the images. You will need to have a server Docker that is running to below tasks. You have an Ubuntu server lying around, you may refer to our previous article on how to install Docker on an Ubuntu server.( if you don’t have one, and********)
The command examples here were done on an Ubuntu virtual machine hosted in SimplerCloud, however the same commands will also work on Docker running on any other platforms (such as CentOS, Fedora, Debian etc). Since root account was being used, sudo command was omitted on most of the steps. If you are using a user that is non-root sudo access on a Debian or Ubuntu environment, please append sudo facing each demand (age.g. sudo solution docker status in place of service docker status).
Basic Docker Commands
You can confirm in the event that Docker daemon is operating on your host by operating below commands:
service docker status
ps awx | grep docker
You can easily see your Docker is operating on pid 2836. The Docker daemon is not running, you can start the daemon by running below command:
service docker start
To start using Docker and list down the available commands, type:
To check the Docker information, use “docker info” command.( if for some reason********)
To check the Docker version, use “docker version” command.
How to work with Docker images
To search for available Docker images, use “docker search” command. For example, to list down images that are available Ubuntu, usage “docker search ubuntu” demand.
You might realize that as well as the formal Ubuntu Docker pictures (those that are marked OFFICIAL = [OK]), additionally, there are some extra pictures uploaded by people of this community. Those pictures are typically started with all the username of this known member, e.g. esycat/ubuntu or zoni/ubuntu. Those are custom images made by the users mainly for their own purposes and you should refrain from pulling third-party images you are doing unless you know what. For safety reasons, it is recommended for you really to stick to the state Docker pictures offered.
To pull a graphic, usage “docker pull” demand. For instance, should you want to pull the state Ubuntu image:
docker pull ubuntu
To list down all Docker pictures at this time on your own host, usage “docker pictures” demand.
You can easily see your latest images that are ubuntu have just pulled appears on the list, in addition to the default hello-world Docker image, which is already installed by default.
How to work with Docker containers?
To check the list of Docker containers which are running on your server, use “docker ps” command.
You can see that there are no containers running yet. To list all the containers that are available your host, though it’s maybe not operating, usage “-l” choice on “docker ps” demand:
docker ps -l
Let’s you will need to run the hello-world container. Usage “docker run hello-world” demand to operate the container.
docker run hello-world
You also can utilize the “docker run” demand to produce a Docker that is new container. For example, below is the command on how to create a Docker container using the Ubuntu image which we have just pulled earlier********) that is:(**************)docker run -i -t ubuntu /bin/bash
The demand will begin the container, and you’ll then be rerouted on bash shell of one’s newly developed Ubuntu container. That we have just created.( if you notice, the “[email protected]:/#” prompt is actually the bash shell prompt within the Ubuntu container********)
You can also run normal Linux commands such as “df” and “uname -a” inside the container.
To exit the container, just type “exit” on the terminal shell.
You will then be re-directed back to the parent system that is operating. Keep in mind that whenever you exit, the container is likewise stopped. It is possible to confirm by doing another “docker ps**********************)( that is-l( command.
(you have managed to run a Docker container on your server.
Next article: how to produce your personal pictures (update and commit the pictures), and push your pictures to the Docker Hub repository.
Disclaimer : this really is another guest that is great article by Indra Pramana from SimplerCloud.com, a cloud servers provider from Singapore with solutions built from the ground up to provide truly real-time, scalable and easily managed cloud infrastructure for start-ups, developers and business throughout Asia.