|
Docker is an open source software, it can be a Linux application and it depends on everything (such as configuration files) are encapsulated into a container. However, Docker virtual machine, it uses the sandbox mechanism, Docker container does not run the operating system, which shared operating system on the host. Now I will install and use the Docker in Ubuntu 14.04.
Docker so on the same server can run more applications - by providing an extra layer of abstraction and automation of operating system-level virtualization. Docker use the Go language development and license agreement with Apache 2.0 release.
A, Docker demand
To install Docker in Ubuntu 14.04 x64, you need to ensure that Ubuntu is a 64-bit version, and kernel version must be greater than version 3.10.
Check the Ubuntu kernel version
# Uname -r
3.13.0-55-generic
Updating the system, to ensure the effectiveness of the package list
# Apt-get update
If Ubuntu version is not satisfied, the need to upgrade Ubuntu
# Apt-get -y upgrade
Second, the installation Docker
Once these requirements are met, you can begin installing Docker. Docker earliest only supports Ubuntu, CentOS and other RedHat later with the associated distribution. Installation is very simple, execute the command:
# Apt-get -y install docker.io
Third, create a link
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
Fourth, check Docker service
To check the status of services Docker, execute the following command to ensure Docker service is started.
# Service docker.io status
docker.io start / running, process 14394
Docker should run in daemon, execute the following command :( attention to the need to close Docker Service)
# Docker -d &
Five, Docker since the launch of the service
The Docker installed as a service from the start, it automatically starts running with the server, execute the command:
# Update-rc.d docker.io defaults
Six, Docker usage
Here to talk about Docker usage. To view the command Docker can be used in terminal operations docker command, it will print a list of all available commands and descriptive.
# Docker
Seven, Docker container download
Let docker command with the option to pull, pull a mirror, that is downloaded from a mirror Docker Docker registration server depot.
Use the following command:
# Docker pull ubuntu
Executing this command will spent some time.
Eight, run Docker container
Ubuntu can now see the establishment of a container at Bash Shell is very simple, just run one line command.
-i option: Let the input and output are standard console
-t option: allocate a tty
# Docker run -i -t ubuntu / bin / bash
root @ 696d5fd32bba: / #
Therefore, the output prompt, you can see the standard Ubuntu container.
You can now use the Bash Shell in Ubuntu's Docker container. If you want to stop / disconnect, you can use the key combination Ctrl-p + Ctrl-q, and then will return to the previous window.
Nine, Docker group
Create a docker user groups, avoid using the root user, and allows users docker user group have the same privileges as root.
# Usermod -aG docker ubuntu
You can now exit the current user, use the user login docker.
Ten, Docker test
Execute the following command to view the output:
docker @ ubuntu-14: / root $ docker run hello-world
Snapshot output display, docker user work.
Eleven, Docker container available
Docker containers available through the search command to find the community has provided a number of containers available. How to find Docker container available, use the following command to search for the CentOS Docker container.
# Docker search centos
XII Conclusion
This article is a Docker introductory information, we should continue still faces many challenges. |
|
|
|