This tutorial provides a straightforward guide to installing Docker on Rocky Linux 8. Docker is a popular platform for containerizing applications, making it easy to package and deploy software.
rocky linuxmade simple
XXXLarge
VPS
8
vCPU
32 GB
Memory
320 GB
NVMe Disk
16384 GB
Traffic
76.90€
/month
* Up to 16 vCPU, 96GB RAM and 960GB NVMe Disk Space
#### Prerequisites
Before you begin, ensure you have:
- A server running Rocky Linux 8 (64-bit)
- SSH access to your server with sudo privileges
- Basic familiarity with the command line on Linux
#### Step 1: Install Docker Engine
Add the Docker repository and install Docker Engine:
```bash
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install docker-ce --nobest -y
```
#### Step 2: Start and Enable Docker
Start the Docker service and enable it to start on boot:
```bash
sudo systemctl start docker
sudo systemctl enable docker
```
#### Step 3: Verify Docker Installation
Check the Docker version to verify the installation:
```bash
docker --version
```
#### Step 4: Run a Docker Container (Optional)
Pull a test image and run a container to verify Docker functionality:
```bash
sudo docker run hello-world
```
This command downloads a test Docker image and runs it in a container.
#### Step 5: Manage Docker as a Non-root User (Optional)
If you want to manage Docker as a non-root user, add your user to the `docker` group:
```bash
sudo usermod -aG docker $USER
```
Log out and log back in for the changes to take effect.
#### Step 6: Basic Docker Commands
Explore some basic Docker commands to manage containers:
- List running containers:
```bash
docker ps
```
- List all containers (including stopped ones):
```bash
docker ps -a
```
- Pull an image from Docker Hub:
```bash
docker pull image_name
```
- Start a stopped container:
```bash
docker start container_name_or_id
```
#### Conclusion
You have successfully installed Docker on Rocky Linux 8 and verified its functionality with a test container. Start using Docker to containerize and manage your applications efficiently.
**Additional Resources:**
- **Docker Documentation:** [https://docs.docker.com/](https://docs.docker.com/)
- **Rocky Linux Documentation:** [https://docs.rockylinux.org/](https://docs.rockylinux.org/)