Docker install application (centos6.5_x64)

Source: Internet
Author: User

Docker install application (centos6.5_x64)


Authoer::[email PROTECTED]/7/23


Docker official website http://www.docker.com/


One, install Epel

About EPEL:HTTPS://FEDORAPROJECT.ORG/WIKI/EPEL/ZH-CN

>RPM-IVH http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
>rpm--import/etc/pki/rpm-gpg/rpm-gpg-key-epel-6
>yum-y Install Yum-priorities


Second, install Docker

>yum-y Install Docker-io
>service Docker Start
>chkconfig Docker on


Third, apply Docker

1. Get the CentOS image
>docker Pull Centos:latest

2. View the performance of the Mirror
>docker Images CentOS

3. Execute Shell bash under the container
>docker run-i-T Centos/bin/bash

4, Stop container
>docker Stop <container id>

5. View Container Logs
>docker logs-f <container id>

6. Remove all containers
>docker RM $ (Docker ps-a-Q)

7, remove mirror
>docker RMI <image id/name>

8, commit container changes to mirror Warehouse
>docker run-i-T Centos/bin/bash
>useradd MyUser
>exit
>docker ps-a |more
>docker Commit <container id> Myuser/centos

9, create and execute the hello.sh in the container
>docker run-i-T Myuser/centos/bin/bash
>touch/home/myuser/hello.sh
>echo "echo \" Hello,world!\ "" >/home/myuser/hello.sh
>chmod +x/home/myuser/hello.sh
>exit
>docker Commit <container id> Myuser/centos
>docker run-i-T myuser/centos/bin/sh/home/myuser/hello.sh

10, perform nginx in the container

Install Nginx in the container and add it to the nginx.conf head:
Daemon off;
Save, exit the container to commit to the mirror.
Start the Nginx in Docker
>docker run-d-P 81:80 Nginx/centos/data/apps/nginx/sbin/nginx
Visit host 81port in the browser.

11. Map Container Port
>docker run-d-P 192.168.9.11:2201:22 nginx/centos/usr/sbin/sshd-d

Using SSH [email protected] -P 2201 to connect the container, prompt:

Connection to 192.168.1.205 closed. (This issue has not been resolved!!!)


Problems you may encounter:
# #在容器里面改动用户password的时候报错:
/usr/share/cracklib/pw_dict.pwd:no such file or directory
Pwopen:no such file or directory

Solve:
yum-y Reinstall Cracklib-dicts

Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Docker install application (centos6.5_x64)

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.