1.7.0 version Docker installation and use

Source: Internet
Author: User

Server is Ubuntu server 14.04, kernel: 3.13.0-32-generic , hardware is Dell R520

First, installation

Method One:

Package installation via system

The Ubuntu 14.04 version of the system has its own Docker package, which can be installed directly.

$ sudo apt-get update

$ sudo apt-get install-y Docker.io

$ sudo ln-sf/usr/bin/docker.io/usr/local/bin/docker

$ sudo sed-i ' $acomplete-F _docker Docker '/etc/bash_completion.d/docker.io


Method Two:

Install the latest version from the Docker source

To install the latest version of Docker you need to use a Docker source to install

# apt-get-y Install Apt-transport-https

# Apt-key adv--keyserver hkp://keyserver.ubuntu.com:80--recv-keys 36a1d7869245c8950f966e92d8576a8ba88d21e9

# bash-c "Echo Deb Https://get.docker.io/ubuntu Docker main >/etc/apt/sources.list.d/docker.list"

# Apt-get Update

# apt-get-y Install Lxc-docker

# Docker-v//View Docker version

# Ps-ef | grep Docker

Root 17311 1 0 Feb13? 00:00:43/usr/bin/docker-d


2. Download the tar package and add the image

in general, when you download the image, it's Docker search Image_name, then Docker pull Image_name

However, due to recent GFW blocked the network, in the present time there will be the following error, simply pull the mirror.

Pull ingrepository centos

2014/05/1913:35:11 Gethttps://cdn-registry-1.docker.io/v1/repositories/library/centos/tagsreadtcp162.159.253.251:443: connection timed out


So in order to solve this problem, I downloaded the packaged tar from somewhere else (explained later and then packaged it myself), and then I used Docker load to import Download first (with CentOS and Ubuntu)

wget http://docker.widuu.com/ubuntu.tar

wget http://docker.widuu.com/centos.tar

加入到镜像里

#docker load -i centos. tar #docker load -i ubuntu. tar

查看镜像列表

#docker images

REPOSITORY        TAG                 IMAGE ID            CREATED             VIRTUAL SIZE <none>            <none>              607347d2a946        3 months ago        300.2 MB ubuntu /widuu latest               963b9d0e10ba        3 monthsago         155 MB

给centos的改个名

#docker tag 607 centos:latest

#docker images REPOSITORY         TAG                 IMAGE ID            CREATED             VIRTUAL SIZE centos             latest              607347d2a946        3 months ago        300.2 MB ubuntu /widuu latest              963b9d0e10ba        3 monthsago         155 MB

Test if the image is available

#docker run centos /bin/echo "hello,i‘m centos system"

hello,i‘mcentos system #docker run ubuntu/widuu /bin/echo "hello,i‘m ubuntu system" hello,i‘mubuntu system

Using swap mode

#docker run -i -t centos /bin/bash

bash -4.1 #ifconfig eth0      Link encap:Ethernet  HWaddr BA:08:86:7F:F8:48             inet addr:172.17.0.4  Bcast:0.0.0.0 Mask:255.255.0.0            inet6 addr: fe80::b808:86ff:fe7f:f848 /64Scope :Link            UP BROADCAST RUNNING  MTU:1500 Metric:1            RX packets:6 errors:0 dropped:2overruns:0 frame:0            TX packets:2 errors:0 dropped:0overruns:0 carrier:0            collisions:0 txqueuelen:1000            RX bytes:488 (488.0 b)  TX bytes:168 (168.0 b)   lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0            inet6 addr: ::1 /128 Scope:Host            UP LOOPBACK RUNNING  MTU:1500 Metric:1            RX packets:0 errors:0 dropped:0overruns:0 frame:0            TX packets:0 errors:0 dropped:0overruns:0 carrier:0            collisions:0 txqueuelen:0            RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)   bash -4.1 # exit

There are 2 ways to exit, one is to exit completely, use exit, and the other is to not exit completely, using CTRL-P and Ctrl-q

So you're not completely out, but the container state is still there.

You can use the Docker attach CONTAINER ID to re-enter.

If you are completely out of the Docker container status display exited, you need to restart the Docker container and enter in using Attach.

Docker start CONTAINER ID

Docker Attach CONTAINER ID


Second, Private library

because GFW, so there is no way to play Docker pull and push, and for security reasons, in order to solve the building of a private library.

# git clone https://github.com/dotcloud/docker-registry.git# cd docker-registry# CD config# CP config_sample.yml config.yml# CD. # apt-get Install Python-pip gunicorn build-essential python-dev libevent-dev python-pip liblzma-dev-y# pip Install-r re quirements.txt# gunicorn-k gevent--max-requests--graceful-timeout 3600-t 3600-b localhost:5000-w 8-d--access-l Ogfile/tmp/gunicorn.log docker_registry.wsgi:application

客户端推送镜像到私有库1、  先注册账号

# docker login localhost:5000
Enter your account number, password, Email 2, label the submitted image

# docker ps container id        image                 COMMAND              CREATED              STATUS               PORTS                NAMES504d16302ad4        jdeathe/centos-ssh    "/ Bin/bash "         About an hour ago    Up 42 minutes       22/tcp               serene_bardeen      #  docker commit 504d16302ad4 centos:v1b47276971c2db84bd76659da86a4ea5bda227f008c5004152232183066f20533# docker  images repository           tag                  IMAGE ID             CREATED              VIRTUAL SIZEcentos                v1                   b47276971c2d        7  seconds ago       376.8 mbjdeathe/centos-ssh    latest              b071db8f6e23     &nbsP;   4 weeks ago         238 mb 







http://docker.widuu.com/

This article is from the "Start from the Heart" blog, please be sure to keep this source http://hao360.blog.51cto.com/5820068/1665857

1.7.0 version Docker installation and use

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.