Docker is an open source project, provides an open platform for developers and system administrators, in any place and run by packaged applications as a lightweight container. Docker automatically deploy applications in a software container. Docker most started by Solomon Hykes dotCloud as an internal development project, an enterprise-class PaaS (platform as a service platform services), the software is now maintained by the community and Docker Docker company, Docker more information you can visit: HTTPS: // docs.docker.com/ .
We can provide through the KVM and Docker Docker official image of the picture more know what Dock:
Docker install the required conditions: the need for 64-bit architecture of the system and the version of the kernel Linux 3.10 or higher. Here the authors used the Ubuntu 3.19 kernel version 15.04 system.
Learn more about some of Docker
Here you can learn the most basic conditions docker world.
Docker Images
Docker image is Docker container basic template. image generic container to make the system easy to install and use, Docker image is used to run the container, you can find a lot of images (multiple operating systems and the software has been installed in the Docker) here https://hub.docker.com / .
Docker Container
Docker container (Container Docker) is an Image, read and write operation on Docker Image. Docker is a combined file system as a container background, any change in the container will be stored on a new basic image layer. We install the application layer is the container. Each container run on the host machine is independent, therefore, to provide a secure application platform.
Docker Registry
Docker registry is provided for Docker images library. It provides public and private libraries. Public libraries are called Docker Docker Hub. Here we can upload the push and pull of our own images.
Docker installation on Ubuntu 15.04
Below we will guide you how to install the docker. We need to check before installing the operating system kernel version and architecture.
Run the command:
uname -a
You can see that we are using ubuntu 15.04 64 bit version of the kernel and kernel 3.19.
Docker now run the installation command:
sudo apt-get install -y docker.io
Wait for the installation is finished, now we use the following command to start the Docker:
systemctl start docker
Error:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/images/search?limit=25&term=ubuntu: dial unix /var/run/docker.sock: connect: permission denied
solve:
sudo groupadd docker #添加docker用户组 sudo gpasswd -a $USER docker #将登陆用户加入到docker用户组中 newgrp docker #更新用户组 docker ps #测试docker命令是否可以使用sudo正常使用
运行系统引导时启用 docker,命令:
systemctl enable docker
你可能想核对一下 docker 版本:
docker version
现在,docker 已经安装在您的系统上。您可以从 Docker 库先下载 Docker Image 制作的容器。
Docker 的基本用法
在本节中,我将向您介绍 Docker 命令的常用选项。例如如何下载一个 docker image,打造一个容器,以及如何访问容器。
要创建一个新的容器,你应该选择一个基本 image 的操作系统,例如启动 Ubuntu 或者 CentOS 或其他系统。您可以搜索一个基本 image 使用 Docker 搜索命令:
docker search ubuntu
该命令将显示所有 ubuntu images,你可以自己尝试一下搜索 centos Images。
现在我们现在 base image到我们的服务中,使用命令:
docker pull ubuntu
现在,您可以通过使用命令来查看所有已下载的images:
docker images
Ubuntu 镜像从DockerHub/Docker Registry下载。下一步骤是创建从该镜像的容器。
要创建容器,可以使用docker create 或 docker run
docker create ubuntu:14.04
docker create 命令会创建一个新的容器,但不会启动它。所以现在你需要使用运行命令:
docker run -i -t ubuntu:14.04 /bin/bash
此命令将创建并运行一个基于 Ubuntu14.04 镜像的容器,容器内并运行一个命令/bin/bash,您将在容器内自动运行命令。
当你输入 Exit 命令退出容器时,容器也是停止运行,如果你想容器在后台运行需要在命令后面添加 -d 参数。
docker run -i -t -d ubuntu:14.04 /bin/sh -c “while true; do echo hello world; sleep 1; done”
/bin/sh -c “while true; do echo hello world; sleep 1; done” this is bash script to echo “hello word” forever.
现在你可以看到容器在后台运行通过命令:
docker ps
如果你想从 bash 命令看日志结果,使用命令:
docker logs NAMES/ContainerID
怎样在后台访问容器 shell?这个命令将会连接你的容器 shell:
docker exec -i -t NAMES/ContainerID
你可以看到主机名和容器ID是相等的,这意味着你在容器shell内。当你在shell 上键入’exit`,会离开的shell,但容器仍在运行。
你会经常使用的另一个命令是:
docker stop NAME/ContainerID
这将停止容器而不将其删除,这样你就可以用命令重新启动它:
docker start NAME/ContainerID
If you want to remove the container, stop it, and then use the command to remove it:
docker rm NAME/ContainerID
This is a simple to use, detailed usage can be accessed here .
Docker install the application (CentOS 6.5_x64) http://www.linuxidc.com/Linux/2014-07/104595.htm
Ubuntu 14.04 installation Docker http://www.linuxidc.com/linux/2014-08/105656.htm
Ubuntu desktop using VNC to run Docker system based http://www.linuxidc.com/Linux/2015-08/121170.htm
6.5 template installation Docker Ali cloud CentOS http://www.linuxidc.com/Linux/2014-11/109107.htm
Ubuntu 15.04 installed at Docker http://www.linuxidc.com/Linux/2015-07/120444.htm
14.04 Trusty Docker mounted in the Ubuntu (the LTS) (64 'bit-) http://www.linuxidc.com/Linux/2014-10/108184.htm
Details of Docker : click here
Download Docker's : click here