Install and use Dockerchszs in Ubuntu 14.04, All rights reserved, without permission. shall 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 (for example, a configuration file) into a single container. However. Docker differs from a virtual machine in that it uses a sandbox mechanism. The Docker container does not execute the operating system, it shares the operating system on the host.
Below I will install and use Docker in Ubuntu 14.04.
Docker makes it possible to perform many other applications on the same server-it proactively by providing an additional layer of abstraction and operating system-level virtualization.
Docker uses go language development. and published under 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 number is 64-bit, and that the kernel version number is greater than the 3.10 version.
Check the Ubuntu kernel version number
# 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 number is not met, you will need to upgrade Ubuntu
# Apt-get-y Upgrade
Second, install Docker
Once the above requirements are met. will be able to start installing Docker. Docker was the first to support Ubuntu only, and later had CentOS and other Redhat-related release packages. Install very easy, execute 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. Ensure that the Docker service is started.
# service docker.io statusdocker.io start/running, process 14394
To execute Docker as a daemon, execute the following command: (note the Docker service must be closed first)
# docker -d &
Five, Docker self-start service
Install Docker as a self-starter service, and let it take its own initiative as the server starts. Execute command:
# update-rc.d docker.io defaults
Vi. How to use Docker
Let's talk about how Docker is used. To view the commands that Docker can use, execute the Docker command at the terminal. It will print a list of all available commands and use descriptive narratives.
# 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 Register server's software repository.
The commands used are as follows:
# docker pull ubuntu
The execution of this command takes some time.
Viii. implementation of Docker containers
Now it's easy to see how to build Ubuntu containers under the bash shell, just a single line of command.
-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 that are used.
Bash shells can now be used in Ubuntu's Docker containers. Assuming that you want to stop/disconnect, you can use the combo key ctrl-p + ctrl-q and then return to the previous form.
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
Now it is possible to 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 is displayed in the snapshot. Docker users work fine.
Xi. Docker available containers
Docker-Available containers are searchable with search commands, and the community has provided a lot of available containers.
How to find the available Docker containers, use the following command to search the CentOS Docker container.
# docker search centos
12. Conclusion
This article is a Docker primer, and there are a number of challenges to keep going deep.
Installing and using Docker in Ubuntu 14.04