In Ubuntu 14.04 installation and use of Dockerchszs, all rights reserved, without consent, may not be reproduced. Blogger Home: Http://blog.csdn.net/chszs
Docker is an open source software that encapsulates a Linux application and everything it relies on (such as a configuration file) into a single container. However, unlike virtual machines, Docker uses the sandbox mechanism, which does not run the operating system, and it shares the operating system on the host. Below I will install and use Docker in Ubuntu 14.04.
Docker makes it possible to run more applications on the same server-it provides an additional layer of abstraction and OS-level virtual automation. Docker is developed using the Go language and is published in the Apache 2.0 license agreement.
First, the needs of Docker
To install Docker in Ubuntu 14.04 x64, you need to make sure that the Ubuntu version is 64-bit and that the kernel version needs to be larger than 3.10.
Check the Ubuntu kernel version
# Uname-r
3.13.0-55-generic
Update the system to ensure the validity of the package list
# Apt-get Update
If the Ubuntu version is not met, you will need to upgrade Ubuntu
# Apt-get-y Upgrade
Second, install Docker
Once the above requirements are met, you can start installing Docker. Docker only supported Ubuntu at the earliest, and later had CentOS and other redhat-related releases. The installation is simple and executes the command:
# apt-get -y install docker.io
Third, create links
Create a soft link
# ln -sf /usr/bin/docker.io /usr/local/bin/docker # sed -i ‘$acomplete -F _docker docker‘ /etc/bash_completion.d/docker.io
Iv. Checking the Docker service
To verify the status of the Docker service, execute the following command to ensure that the Docker service is started.
# service docker.io statusdocker.io start/running, process 14394
To run Docker as a daemon, execute the following command: (note the Docker service needs to be closed first)
# docker -d &
Five, Docker self-start service
Install Docker as a self-starting service and let it run automatically as the server starts, executing commands:
# update-rc.d docker.io defaults
Vi. usage of Docker
Let's talk about the usage of Docker. To view the commands that Docker can use, run the Docker command at the terminal, which prints all the available command lists and usage descriptions.
# docker
Seven, docker container download
Below we have the Docker command with the pull option, which pulls a mirror that downloads a docker image from the Docker Registry server's software repository.
The following commands are used:
# docker pull ubuntu
The execution of this command takes some time.
Viii. Running Docker containers
Now it is very easy to see that the Ubuntu container is built under the bash shell, just run a single line of commands.
-I option: let the input and output be in the standard console
-T option: assigning a TTY
# docker run -i -t ubuntu /bin/bash[email protected]:/#
Therefore, in the output hint, you can see the standard Ubuntu containers used.
Bash Shell can now be used in the Ubuntu Docker container. If you want to stop/disconnect, you can use the combination key ctrl-p + ctrl-q, and then you will return to the previous window.
Nine, Docker group
Create a Docker user group, avoid using the root user, and let the users of the Docker user group have the same root privileges.
# usermod -aG docker ubuntu
You can now exit the current user and log in with the Docker user.
Ten, Docker test
Execute the following command to view the output:
[email protected]:/root$ docker run hello-world
The output from the snapshot shows that the Docker user is working properly.
Xi. Docker available containers
Docker-Available containers can be found through search commands, and communities have provided a lot of available containers. How to find the available Docker containers, use the following command to search for the CentOS container for the.
# docker search centos
12. Conclusion
This article is a Docker primer, and there are a number of challenges to keep going deep.
Copyright NOTICE: This article for Bo Master Chszs original article, without Bo Master permission not reproduced.
Installing and using Docker in Ubuntu 14.04