Here is how I setup docker (for Ubuntu) in Lab21.
First, I update package repository at my Ubuntu server, and follow by installing 4 prerequisite packages and installing docker.io package. Finally, I setup Docker to start automatic.
$ sudo apt update
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
$ sudo apt install docker.io
$ sudo systemctl start docker.service
$ sudo systemctl enable docker.service
Optionally, you can add the official Docker repository by, and install from the Docker repo (instead of the default Ubuntu repo):
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
$ sudo apt install docker-ce
Verify and gather Docker version:
$ sudo docker version
Quickly show information about Docker client/server with how many containers are running:
$ sudo docker info
To run Docker without root
$ sudo usermod -aG docker $USER
$ reboot
Search, Install and run a Docker image [nginx, hello-world]
$ docker search nginx
$ docker pull hello-world
List installed images and Monitor Docker (CPU, RAM, network)
$ docker images
$ docker container ls
$ docker stats
$ docker network ls
Managing Docker images:
Committing changes in a Container to a Docker image:
Pushing Docker image to Docker repository:
Links:
- https://linuxconfig.org/install-docker-on-almalinux
- https://linuxconfig.org/how-to-install-docker-on-ubuntu-22-04
- https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04