Docker Hub is an internet registry service that allows us to download docker images built by communities. Or, we can also upload our own images to the Docker hub and share it with communities. I will explain a bit more about Docker Hub on this post. I am not a Docker pro, I just started learning docker and I think it is good to share my learning experiece with anyone who just started to learn Docker like my self.
Docker Hub Sign Up
It is not mandatory to have Docker Hub account. Without the Docker Hub account, we still able to download images from the community. But, if we want to upload our images, we need this account. To create new account, simply go to this website and enter your credentials.
Explore Docker Hub
In order to explore Docker Hub, we don’t need an account. Simply click the following url to browse and explore any applications, images developed by community.
But now, thre is a new place to discover Public Docker content at Docker store. In Docker store, you can find free and also commercial Docker contents.
Pull Image from Docker Hub/Docker Store
Search any application from Docker Store. In this example, I use mariadb at this link.
docker pull mariadb
Now we can list the images available locally with docker images command
root@ubuntu-server:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@ubuntu-server:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mariadb latest ea0322bb4096 11 days ago 395.2 MB
Run a container from the image
After we pulled the image, we can now run a container using the image we’ve downloaded. There should be a detailed information in the docker hub about how to run the container using the image.
docker run –name mariadb_01 -e MYSQL_ROOT_PASSWORD=12345678 -d mariadb:latest
ubuntu@ubuntu-server:~$ sudo docker run –name mariadb_01 -e MYSQL_ROOT_PASSWORD=12345678 -d mariadb:latest
At this point, a new container is up and running using the image we’ve pulled previously.