This tutorial is good for starting with docker on rockylinux-9
Install docker repo as root with priority=50
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo dnf install docker-ce docker-ce-cli containerd.io systemctl start docker systemctl status docker systemctl enable docker
Add your username to docker group
usermod -aG docker $USER
Download and install hub-tool
cd /tmp wget https://github.com/docker/hub-tool/releases/download/v0.4.6/hub-tool-linux-amd64.tar.gz tar -xvf hub-tool-linux-amd64.tar.gz mv hub-tool hub-tool-v0.4.6 mv /tmp/hub-tool-v0.4.6 /opt chown -Rv root:root /opt/hub-tool-v0.4.6 chcon -u system_u -t usr_t -Rv /opt/hub-tool-v0.4.6
Add hub-tool to your PATH
emacs ~/.bashrc.d/bash_aliases export PATH=/opt/hub-tool-v0.4.6:$PATH
Docker has a good help online
docker docker search --help
Per default you don't have any local images
docker images REPOSITORY TAG IMAGE ID CREATED SIZE
Run the docker "Hello World" example
docker run hello-world
Show docker disk usage
docker system df
Search for RockyLinux images on Docker Hub
docker search rockylinux
Setup hub-tool with a docker account
hub-tool --version hub-tool login user=* pass=*
List all tags of rockylinux/rockylinux
hub-tool tag ls --sort updated rockylinux/rockylinux TAG DIGEST STATUS LAST UPDATE LAST PUSHED LAST PULLED SIZE rockylinux/rockylinux:9-minimal sha256:9e67a934b74b8fe2ef9d... active 2 months ago 2 months 22 minutes 241.4MB rockylinux/rockylinux:9.5 sha256:531a9a14d0e640d32f61... active 2 months ago 2 months 51 seconds 348.7MB rockylinux/rockylinux:8 sha256:f514765516176a9aa472... active 8 months ago 8 months About a minute 151.8MB rockylinux/rockylinux:8.10-minimal sha256:55ddcbe11a7bf1696f67... active 8 months ago 8 months 7 minutes 76.57MB rockylinux/rockylinux:8.10 sha256:f514765516176a9aa472... active 8 months ago 8 months About a minute 151.8MB
Download an image
docker pull rockylinux/rockylinux:9.5
A second pull will check if a download is really necessary
docker pull rockylinux/rockylinux:9.5 9.5: Pulling from rockylinux/rockylinux Digest: sha256:149fd31d916038eb1084d0e051537e279d7afcd5de0b365254e8fa3c3ef12bad Status: Image is up to date for rockylinux/rockylinux:9.5 docker.io/rockylinux/rockylinux:9.5
Create a new container and install some packages
docker run -it rockylinux/rockylinux:9.5 [root@c779d77f7557 /]# dnf install epel-release dnf install htop ncurses file vim-minmal exit
Create an image from container c779d77f7557
docker commit -m "generic container" -a "Mihai Vasilian" c779d77f7557 mihai-repo/rocky-9
List local images
docker images REPOSITORY TAG IMAGE ID CREATED SIZE mihai-repo/rocky-9 latest aa5326bfb9df 2 minutes ago 344MB hello-world latest 74cc54e27dc4 2 weeks ago 10.1kB rockylinux/rockylinux 9.5 bb8a97547d22 2 months ago 234MB
List local containers
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c54574f205f8 hello-world "/hello" 11 minutes ago Exited (0) 11 minutes ago festive_mirzakhani c779d77f7557 rockylinux/rockylinux:9.5 "/bin/bash" 26 minutes ago Exited (137) 6 minutes ago busy_hamilton
How to use container c779d77f7557
docker start c779d77f7557 : start in detached mode docker stop c779d77f7557 : stop a container docker restart c779d77f7557 : restart in detached mode docker exec -it c779d77f7557 bash : execute a command in a running container
Remove container c54574f205f8 (hello-world)
docker rm c54574f205f8
Remove image 74cc54e27dc4 (hello-world)
docker rmi 74cc54e27dc4 Untagged: hello-world:latest Untagged: hello-world@sha256:d715f14f9eca81473d9112df50457893aa4d099adeb4729f679006bf5ea12407 Deleted: sha256:74cc54e27dc41bb10dc4b2226072d469509f2f22f1a3ce74f4a59661a1d44602 Deleted: sha256:63a41026379f4391a306242eb0b9f26dc3550d863b7fdbb97d899f6eb89efe72Back to main index