Install and run docker on gentoo linux
Table of Contents
1 Introduction
Docker is a container virtualization environment that can establish development or runtime environments without modifying the host operating system. It is faster and lighter than full hardware virtualization.
This article will guide you through the steps required to install and run Docker on Gentoo Linux.
2 Installtion
The official sys-kernel/gentoo-kernel-bin package supports running Docker.
For the customized kernel, refer to Docker: Kernel to configure the proper kernel options.
Default USE flags can be utilized. It is recommended to read the messages for the package app-containers/docker when emerging Docker and recompile the kernel based on what is not set but should be.
To check the kernel configuration compatibility, run:
$ /usr/share/docker/contrib/check-config.sh
Install the app-containers/docker and app-containers/docker-cli packages.
$ sudo emerge --ask --verbose app-containers/docker app-containers/docker-cli
3 Configuration
Add your user to the 'docker' group to grant the necessary privileges to run Docker.
$ sudo usermod -aG docker $USER
Start the docker service and add it to default runlevel.
$ sudo rc-service docker start $ sudo rc-update add docker default
4 Usage
To test the installation, run the following command:
$docker run --rm hello-world
You shall see information similar to this:
Hello from Docker. This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker Hub account: https://hub.docker.com For more examples and ideas, visit: https://docs.docker.com/get-started/
Fetches the busybox image from the Docker registry and save it locally.
$ docker pull busybox
Run a Docker container based on the busybox image. With the -it flags, it will give us an interactive TTY.
$ docker run -it busybox sh
To create your own image, start by editing a file named "Dockerfile" with the following contain:
FROM busybox
Install Docker Buildx as the legacy builder is going to be deprecated.
$ sudo emerge --ask app-containers/docker-buildx
Build the image.
$ docker build -t my-busybox .
Test running your new image.
$ docker run -it busybox sh
Created: 2024-04-15 Mon 13:04
No comments:
Post a Comment