Installing Docker under ubuntu15.04

Source: Internet
Author: User
Tags docker ps docker run

Get more information Welcome to my website or csdn or blog park

Recently heard that Docker is very hot, do not know what things, only know is a container, can cross the platform. Free to do nothing, I also come to dealing things dealing things. This article mainly introduces: installation under Ubuntu, as well as basic introductory command introduction; my machine is ubuntu15.04.64-bit

What is Docker

Docker is an open source project that was born in early 2013 and was originally an amateur project within the DotCloud company. It is based on Google's launch of the Go language implementation. The project later joined the Linux Foundation and complied with the Apache 2.0 protocol, and the project code was maintained on GitHub.
Docker has been widely watched and discussed since open source, so that DotCloud company later changed its name to Docker INC. Redhat has focused on supporting Docker;google in its RHEL6.5 and is also widely used in its PaaS products.
The goal of the Docker project is to implement a lightweight operating system virtualization solution. Docker is based on technologies such as Linux containers (LXC).
On the basis of LXC, Docker has been further encapsulated, so that users do not need to care about the management of containers, making the operation easier. User-operated Docker containers are as simple as operating a fast, lightweight virtual machine.

Installation Dockerdocker installation Method one

ubuntu14.04 and above are all self-installing Docker packages, so they can be installed directly, but this is not the first version.

sudo apt-get updatesudo apt-get install docker.io
Docker installation method two; Install the latest version
sudo apt-gethttps://get.docker.io/ubuntu/ | sudo sh  这个方法启动docker若出现下面错误;(这个我没遇到)FATA[0000fileordirectory ()别担心,请安装apparmor软件即可sudo apt-get install apparmor
User groups and configuration file modifications
把当前用户加入到docker用户组中sudo-a$USER 添加配置文件sudo vim /etc/default/docker 在配置文件中添加或修改DOCKER="/usr/bin/docker"  重启dockersudo#重启
After the installation is complete, you can test the following commands
-v

Shown below:

That means you've got the installation done.

查看状态:sudo service docker status

Shown below:

其他状态命令:sudo service docker start    #启动 sudo service docker stop    #关闭 sudo#重启 
查看镜像:此时应该没有镜像docker images

Shown below:

Install the first image of Ubuntu
下载docker 镜像,需要几分钟。sudo docker pull ubuntu启动容器,并且进入到Ubuntu容器的bash命令sudo docker run -i -t ubuntu /bin/bash输出hello world

When downloading the phenomenon:


Startup phenomenon: In fact, the equivalent of starting a virtual machine;

Output Hello World:

PS Command:

Docker Common Command Quick check
# Download an ubuntu imagesudoDocker pull Ubuntu# using Ubuntu to run an interactive shell,# Assign a pseudo terminal with stdin and stdout (input/output stream)# If you want to quit the pseudo-terminal that separates,# You can use Ctrl-p+ctrl-q--just like pressing CTRL-P and Ctrl-qsudoDocker Run-i-T Ubuntu/bin/bash#docker PS CommandsudoDocker PS#列出当前所有正在运行的containersudoDocker PS- L #列出最近一次启动的, and the running containersudoDocker PS -A #列出所有的container#port命令Docker Run-p the:8080<image> <cmd>#映射容器的8080端口到宿主机的80端口#删除容器命令sudoDocker RM 'sudoDocker PS -A-Q '#删除所有容器sudoDocker RM$CONTAINER _id#删除容器id为CONTAINER_ID的容器#其他命令快速参考:sudoDocker images#查看本地镜像sudoDocker Attach$CONTAINER _id #启动一个已存在的docker实例sudoDocker stop$CONTAINER _id #停止docker实例sudoDocker logs$CONTAINER _id #查看docker实例运行日志 to ensure proper operationsudoDocker Inspect$CONTAINER _id #查看container的实例属性, such as IP, etc.sudoDocker run-t-i-v/home/linjiqin/dev/docker:/home/mycontainer:rw-p8000:8000Mydocker/bin/bash writes in front, the command that runs our image uses the above as a reference, which mounts the local folder and maps the container8000Port to host.8000Port/home/linjiqin/dev/docker is the local folder to mount, you need to create/home/mycontainer as a Docker mapping path in advance, executing the command above will help us create

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Installing Docker under ubuntu15.04

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.