Let’s dive on Docker Installation steps,
Step 1) Install updates and reboot
Login to Rocky Linux and install all the available updates and then reboot the system once.
$ sudo dnf update -y
$ reboot
Step 2) Configure Docker Package Repository & Install Docker
To install latest and stable version of docker, configure its official package repository using the following command,
$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Now run following dnf command to install docker,
$ sudo dnf install -y docker-ce
Output of commands would like below:
Note: In case you are getting container.io error while installing docker-ce package then run following command,
$ sudo dnf install docker-ce --allowerassing -y
혹 실행시 에러가 발생한다면 selinux를 꺼주시거나 별도로 셋팅해주셔야합니다.
$ sudo setenforce 0
Step 3) Start and enable docker Service
Once docker is installed then start and enable its service using following systemctl commands,
$ sudo systemctl start docker
$ sudo systemctl enable docker
To verify the status of docker run,
$ sudo systemctl status docker
Perfect, above output confirms that docker service is up and running.
If you wish local user to mange and run docker commands, then add the user to docker group using beneath command.
$ sudo usermod -aG docker $USER
After executing the above command, log out and log in once so that docker group is associated to user and user can run docker commands without sudo.
[sysadm@rocky-linux ~]$ docker --version
Docker version 20.10.7, build f0df350
[sysadm@rocky-linux ~]$
Let’s verify the docker installation in the next step.
Step 4) Test docker Installation
To test docker installation, run hello-world container using following docker command,
$ docker run hello-world
Output,
Above output confirms that container ‘hello-world’ has been launched successfully and it also confirms that docker is installed successfully.
Step 5) Install Docker-Compose
Docker Compose command allows to spin up multiple containers in one go. So, to install it run the following commands one after the another.
$ sudo dnf install -y curl
$ sudo curl -L "https://github.com/docker/compose/releases/download/v2.7.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
docker-compose version 2.7.0
$
Above output shows that docker-compose of version 1.29.2 is installed successfully. That’s all from guide. I hope you have found it informative. Please do share your feedback and queries in below comments section.
'프로그래밍 > Linux' 카테고리의 다른 글
[Linux] using rsync command (0) | 2022.11.01 |
---|---|
[Domain] Public IP Check (0) | 2022.10.31 |
[Docker] Docker permission deny 해결법 (0) | 2022.10.20 |
Install Docker and Docker-compose on CentOS7 (0) | 2022.01.13 |
How to install a docker on Linux (Ubuntu, Centos) in one minute (0) | 2021.04.29 |