Docker is used to run software packages called “containers“. Containers are isolated from each other and bundle their own application,tools, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines. Containers are created from “images” that specify their precise contents. Images are often created by combining and modifying standard images downloaded from public repositories.Quote from wikipedia
Firstly, check your kernel. If the kernel has not been configured properly before merging the app-emulation/docker package, a list of missing kernel options will be printed by emerge. These kernel features must be enabled manually.
As for me, not really familiar with kernel menu config , I found a much easier way for me to config the kernel. Firstly I installed docker:
emerge -av app-emulation/docker
And then, I run this command to check that how to config my kernel.
After that, I edit /usr/src/linux, search and replace “XXX is not set” by “XXX=y”. XXX is everything output in check-config.sh above. If XXX cannot be found in .config, just save, make menuconfig, exit, save, and edit it again.
Then, compile the kernel and install it.
make install modules_install
Finally, we should finish some settings (replace Bold word) :
usermod -aG docker jerry
systemctl enable docker.service
systemctl start docker.service
Follow this article.
Images and containers
Firstly we should know Images and containers.
An image is an executable package that includes everything needed to run an application–the code, a runtime, libraries, environment variables, and configuration files.
A container is launched by running an image, a runtime instance of an image–what the image becomes in memory when executed (that is, an image with state, or a user process). You can see a list of your running containers with the command, docker ps, just as you would in Linux.
To run our first docker, Firstly we should pull the image from library.
docker image pull hello-world
Then we run it. Running it will create a container file, which will not be deleted unless you remove it manually.
docker run hello-world
We can see the output:
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.
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 ID:
For more examples and ideas, visit:
If you do not output like this, please reinstall your docker, there must be something wrong with it. If it workd can see containers via this command:
docker ps -a
Output will be like this table:
|0c220c9ac961||hello-world||“/hello”||2 seconds ago||Exited (0) 2 seconds ago||awesome_noether|
We do not need this hello-world container fill anymore, so we can remove it easily:
docker container rm 0c220c9ac961
docker ps -a