Teach you how to get Docker for a long time

First of all, do not docker think so tall, it is not a mirror, and then through the docker like a virtual machine to run up … docker actually in the real business scene is still very limited. Dockerfile script is not so good to write, some applications are not so good to install.

291579-20160514172129124-288043890.jpg

Nonsense not to say, teach you half a day to get docker!

Their own to download the appropriate version, do not recommend the use of yum, to promote consistency of the version.
Docker-engine-1.7.1-1.el6.x86_64.rpm
Epel-release-6-8.noarch.rpm
Rpm -ivh epel-release-6-8.noarch.rpm
Rpm -ivh docker-engine-1.7.1-1.el6.x86_64.rpm

Start docker

Service docker start

Search the public container image

Docker search centos6.6

Support fuzzy search, but do not think how good the public container, suitable for the company's business or need to build their own.

  NAME DESCRIPTION STARS OFFICIAL AUTOMATED 
Liangtong / centos6.6-httpd 2
Incu6us / centos6.6-with-nginx Wav server for FreeCall 0 [OK]
Eliezio / centos6.6-devtoolset2-gtest Docker image based on Centos 6.6 suitable ... 0 [OK]
Chrisgeorge / centos6.6-py2.6 CentOS 6.6 with Python 2.6 0 [OK]
Leonion / centos6.6 centos6.6 0
Heilee / centos6.6 0
Karthi12345 / centos6.6 0
Kalramain / centos6.6-mysql55 mysql5.5 installed on centos6.6 0

Load the mirror container

Docker pull chrisgeorge / centos6.6-py2.6 <NAME>

Trial run

Docker run -i-t chrisgeorge / centos6.6-py2.6 / bin / bash

So that you log in to your pre-designed container to go inside

Install the application
Yum install openssh-server

You need to modify the contents of the / etc / ssh / sshd_config file

PermitRootLogin yes
UsePAM no
Ssh-keygen -q -N "" -t dsa -f / etc / ssh / ssh_host_dsa_key
Ssh-keygen -q -N "" -t rsa -f / etc / ssh / ssh_host_rsa_key
Mkdir / var / run / sshd
Passwd login password
/etc/init.d/sshd start

Update the mirror
Docker commit ID <name>

Delete the mirror

Docker rmi <neme>

Docker rmi -f

start up
Docker run -d -p 22 -p 8022: 8000 chrisgeorge / centos6.6-py2.6 / usr / sbin / sshd -D

Port the container 8000 port to the docker server port 8022, port the container 22 port randomly to the port

Backup mirror
Docker save chrisgeorge / centos6.6-py2.6> /root/docker-pmd.tar

Restore the mirror
Docker load </root/docker-pmd.tar

Want to run up mirror, it must be equipped with a docker each machine.

Dockerfile

Script: / home / docker / Dockerfile

FROM chrisgeorge / centos6.6-py2.6 # inherited parent container
MAINTAINER wonter # author
RUN yum install nginx # Install nginx in the new container
RUN echo "root: root" | chpasswd # Set the password
EXPOSE 22 # Set the port
CMD /etc/init.d/nginx start # Start the service

Docker build -t wonter.

# Delete the docker history container

Docker ps -a -q | xargs docker rm

    Heads up! This alert needs your attention, but it's not super important.