Basic installation steps Ubuntu Docker installation
Docker supports the following Ubuntu versions:
- Ubuntu precise 12.04 (LTS)
- Ubuntu trusty 14.04 (LTS)
- Ubuntu Wily 15.10
- Other updated versions ...
Pre-conditions
Docker requires an Ubuntu system with a kernel version higher than 3.10 to check the prerequisites on this page to verify that your Ubuntu version supports Docker.
View your current kernel version with the UNAME-R command
[Email protected] : ~-r
Use the script to install Docker1, get the latest version of the Docker installation package
[Email protected] : ~-qO- https://get.docker.com/| sh
After entering the current user's password, the script is downloaded and Docker and dependent packages are installed.
After the installation is complete, there is a hint:
IfYou wouldUse docker as a non-root user, should now consideradding your user to the " Docker " group with:sudo usermod -ag Docker Runoob remember so you'll have to log out Span class= "KWD" >and back in for this to take Effect!
When you want to run Docker directly as a non-root user, you need to execute the sudo usermod-ag Docker runoob command, and then log in again, or you will get the following error
2. Start the Docker backend service
[Email protected] : ~$ sudo service docker start
3. Test Run Hello-world
[Email protected] : ~$ docker Run Hello- World
Detailed test steps
Installing Docker takes 3 steps, downloads docker, installs Docker, and checks if Docker is successful.
Docker currently supports the mainstream of 3 OS Linux, MAC, Windows environments, this article uses the Linux system environment for: Linux Ubuntu 14.04.4 LTS 64bit. Downloading and installing Docker in Ubuntu can be done directly with Apt-get.
Since Docker specifies its own source in the later version of 1.7.1, we need to configure the source of Docker in apt first.
Update apt source, install HTTPS and CA certificate library, default these 2 libraries are already installed.
~ sudo apt-get update~ sudo apt-get install apt-transport-https ca-certificates
Add the key GPG to the apt configuration.
~ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
To add the Docker source to the/etc/apt/souces.list file, my version is 14.04 corresponding to the ubuntu-trusty.
~ sudo vi /etc/apt/sources.list# 增加到最后一行deb https://apt.dockerproject.org/repo ubuntu-trusty main
Next, you can install Docker directly with Apt-get.
~ sudo apt-get update~ sudo apt-get install docker-engine
When the installation is complete, Docker is started by default.
# check docker service ~ Service Docker statusdocker start/running, Process 10013 # check docker for ~ ps-aux|grep dockerroot 10013 0.0 1.0 424948 40584? SSL 22:29 0:00/usr/bin/dockerd--raw-logsroot 10022 0.0 0.2 199680 10280? SSL 22:29 0:00 docker-containerd-l Unix:///var/run/docker/libcontainerd/docker-containerd.sock-- Shimdocker-containerd-shim--metrics-interval=0--start-timeout 2m--state-dir/var/run/docker/libcontainerd/ Containerd--runtime docker-runc# Check the Docker version ~ sudo docker versionclient:version: 1.12.1 API version:1.24 Go version:go1.6.3 Git commit:23cf638 built:thu 05:22:43: linux/amd64server:version:1.12.1 API version:1.24 Go version:go1.6.3 Git commit:23cf638 built:th U 05:22:43 os/arch:linux/amd64
Check if Docker is successful, run Hello-world. If the following information appears, the Docker engine installation succeeds.
~ sudo docker run hello-worldunable to find image ' Hello-world:latest ' locallylatest:pulling from library/hello-worldc04b 14da8d14:pull Complete Digest:sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9status: Downloaded newer image for Hello-world:latesthello from docker! This message shows the 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 this image which runs the executable that produces the output is Currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something + ambitious, you can run an Ubuntu container with: $ docker run-it ubuntu Bashshare images, automate Workflows, and more with a free Docker Hub account:https://hub.docker.comfor more ExaMples and ideas, visit:https://docs.docker.com/engine/userguide/
Note: We often encounter an error when we execute the above command. cannot connect to the Docker daemon. Is the Docker daemon running on this host?
For example, enter the Docker run Hello-world command directly.
~ docker run hello-worlddocker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.See ‘docker run --help‘.
This is due to permissions issues, docker default and root permissions bindings, and no permissions if sudo is not added.
Problem resolution Steps
When Docker is installed by default, each time you execute Docker, you run the sudo command, which is a waste of time affecting efficiency. If you do not follow sudo, direct execution docker images
of the command will have the following problems:
FATA[0000] Get http:///var/run/docker.sock/v1.18/images/json:dial Unix/var/run/docker.sock:permission denied. is trying to connect to a tls-enabled daemon without TLS?
So consider how to avoid the use of sudo docker, after looking for information, as long as the user to join the Docker user group, the specific usage is as follows.
2 free sudo using Docker
If you don't have a docker group, add one:
sudo groupadd docker
join the user in the group . Then exit and login again to take effect.
sudo gpasswd -a ${USER} docker
Restarting the Docker service
sudo service docker restart
Toggle current session to new group or restart X session
newgrp - docker
OR
pkill X
Note that the last step is necessary, otherwise, because the groups
command gets the cached group information, the group information just added does not take effect, so the docker images
execution is equally wrong.
3 Cause Analysis
Docker + Ubuntun Install show doc