Skip to content

Instantly share code, notes, and snippets.

@dukenmarga
Last active March 29, 2023 06:16
Show Gist options
  • Save dukenmarga/a5cb8b7ef51ff8f06c13f1bc434348fc to your computer and use it in GitHub Desktop.
Save dukenmarga/a5cb8b7ef51ff8f06c13f1bc434348fc to your computer and use it in GitHub Desktop.
Rocky Linux 9: Install docker and network management

Network management

Source

Network Configuration - Rocky Linux 9

Introduction

NetworkManager is use to manage networking state. As of version 9, NetworkManager is replacing Network-Scripts. NetworkManager is running as service and the status can be checked using command below

systemctl status NetworkManager

Configuration files

NetworkManager --print-config

Show available network interfaces

The default storage location (version 9) is in /etc/NetworkManager/system-connections/

nmcli
nmcli device show
nmcli device show enp0s3

Configure network (setting dynamic/static IP) in interactive mode

nmtui

Configure network (setting dynamic/static IP)

# Set IP to dynamic (DHCP)
nmcli con mod enp0s3 ipv4.gateway '' &&
nmcli con mod enp0s3 ipv4.address '' &&
nmcli con mod enp0s3 ipv4.method auto &&
nmcli con down enp0s3 && nmcli con up enp0s3

# Set DNS manually (usually we don't need this)
nmcli con mod enp0s3 ipv4.dns '8.8.8.8,8.8.4.4,192.168.1.1'

# Don't forget to activate the change by restarting the interface
nmcli con down enp0s3 && nmcli con up enp0s3

Bring the network interface up and down

nmcli con down enp0s3
nmcli con up enp0s3

Check IP Address

ip addr
ip a

Check routing

ip route
ip r

Install Docker

Source

How To Install and Use Docker on Rocky Linux 9

Update

sudo dnf check-update
sudo dnf update

Add docker repository

sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Install docker

sudo dnf install docker-ce docker-ce-cli containerd.io

Start docker

sudo systemctl start docker

Check docker status

sudo systemctl status docker

Enable docker running as service

sudo systemctl enable docker

Enable running docker as non-root (without sudo)

sudo usermod -aG docker $(whoami)

Reload user

Restart the server or use command below to login to new group docker if you don't want to restart. After restart, you don't need to use command below.

newgrp docker

Check

docker
docker version
docker compose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment