In the previous tutorial (Install Docker on Ubuntu 22.04 LTS (Intel Solution)), we have successfully installed Docker and Docker Compose, and ran our first application “Hello World”. In this tutorial, we will be installing multiple containers and running them all at once.
To follow along in this tutorial, you will need the following:
In this step, we are going to pull a few images from the Docker Hub Repository and they are Debian, CentOS, and Ubuntu.
$ sudo docker pull Debian Using default tag: latest latest: Pulling from library/debian e4d61adff207: Pull complete Digest: sha256:10b622c6cf6daa0a295be74c0e412ed20e10f91ae4c6f3ce6ff0c9c04f77cbf6 Status: Downloaded newer image for debian:latest docker.io/library/debian:latest
$ sudo docker pull centos Using default tag: latest latest: Pulling from library/centos a1d0c7532777: Pull complete Digest: sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177 Status: Downloaded newer image for centos:latest docker.io/library/centos:latest
$ sudo docker pull ubuntu Using default tag: latest latest: Pulling from library/ubuntu 7c3b88808835: Pull complete Digest: sha256:8ae9bafbb64f63a50caab98fd3a5e37b3eb837a3e0780b78e5218e63193961f9 Status: Downloaded newer image for ubuntu:latest docker.io/library/ubuntu:latest
We just successfully pulled 3 images, to verify, type the following command.
$ sudo docker image ls
We see the following result.
REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu latest 2b4cba85892a 6 days ago 72.8MB debian latest d40157244907 8 days ago 124MB centos latest 5d0da3dc9764 5 months ago 231MB
As you can see above, we just pulled down 3 different images from the Docker Hub repository. Now we can start using them.
By using an interactive shell, we can execute bash shell to install and remove packages. For example, let’s take CentOS and execute an interactive shell by using the following command.
$ sudo docker run -it centos bash
This will bring us to the root directory and type ls -la to list directory
[root@0894ec55d7b4 /]# ls -la
This command will list all files and directory in the root user. Please also note that all images that are prebuilt uses root by default. You may or could change to a non-root user but that may take some configurations and a pre-build image for that to work.
To exit CentOS, just type exit. You can however do the same command for Ubuntu and Debian as well.
For more info and sample request, please write to info@icop.com.tw, call your nearest ICOP Branch, or contact our Worldwide Official Distributor.