Install docker1.9.1 on CentOS7

Source: Internet
Author: User

Install docker1.9.1 on CentOS7

I used EPEL official source to install Docker. So in the previous article, I wrote the steps for installing EPEL official source.

1. installation:
yum -y install docker-io

View the Docker version:

docker -v

The result is as follows:

Docker version 1.9.1, build ab77bde/1.9.1
2. Start Docker:

Start Docker as a service

service docker start
3. view existing images:
docker images

No image is displayed here. You need to download the image.

4. Search for and download the desired CentOS image:
docker search centos

The result is as follows:

INDEX       NAME                                      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATEDdocker.io   docker.io/centos                          The official build of CentOS.                   2329      [OK]       docker.io   docker.io/ansible/centos7-ansible         Ansible on Centos7                              74                   [OK]docker.io   docker.io/jdeathe/centos-ssh              CentOS-6 6.7 x86_64 / CentOS-7 7.2.1511 x8...   25                   [OK]docker.io   docker.io/jdeathe/centos-ssh-apache-php   CentOS-6 6.7 x86_64 / Apache / PHP / PHP M...   17                   [OK]docker.io   docker.io/nimmis/java-centos              This is docker images of CentOS 7 with dif...   12                   [OK]docker.io   docker.io/million12/centos-supervisor     Base CentOS-7 with supervisord launcher, h...   11                   [OK]docker.io   docker.io/consol/centos-xfce-vnc          Centos container with "headless" VNC sessi...   9                    [OK]docker.io   docker.io/torusware/speedus-centos        Always updated official CentOS docker imag...   8                    [OK]docker.io   docker.io/nickistre/centos-lamp           LAMP on centos setup                            4                    [OK]docker.io   docker.io/centos/mariadb55-centos7                                                        3                    [OK]docker.io   docker.io/nathonfowlie/centos-jre         Latest CentOS image with the JRE pre-insta...   3                    [OK]docker.io   docker.io/consol/sakuli-centos-xfce       Sakuli end-2-end testing and monitoring co...   2                    [OK]docker.io   docker.io/blacklabelops/centos            CentOS Base Image! Built and Updates Daily!     1                    [OK]docker.io   docker.io/darksheer/centos                Base Centos Image -- Updated hourly             1                    [OK]docker.io   docker.io/timhughes/centos                Centos with systemd installed and running       1                    [OK]docker.io   docker.io/yajo/centos-epel                CentOS with EPEL and fully updated              1                    [OK]docker.io   docker.io/ericuni/centos                  centos dev                                      0                    [OK]docker.io   docker.io/grayzone/centos                 auto build for centos.                          0                    [OK]docker.io   docker.io/grossws/centos                  CentOS 6 and 7 base images with gosu and l...   0                    [OK]docker.io   docker.io/januswel/centos                 yum update-ed CentOS image                      0                    [OK]docker.io   docker.io/jsmigel/centos-epel             Docker base image of CentOS w/ EPEL installed   0                    [OK]docker.io   docker.io/kz8s/centos                     Official CentOS plus epel-release               0                    [OK]docker.io   docker.io/labengine/centos                Centos image base                               0                    [OK]docker.io   docker.io/repositoryjp/centos             Docker Image for CentOS.                        0                    [OK]docker.io   docker.io/ustclug/centos                   USTC centos                                    0                    [OK]

Here I usecentos7-ansibleImage, You need to download the image:

docker pull ansible/centos7-ansible

After the download is complete, check the existing image again:

docker images

The result is as follows:

REPOSITORY                          TAG                 IMAGE ID            CREATED             VIRTUAL SIZEdocker.io/ansible/centos7-ansible   latest              8bfa335400c7        27 hours ago        454.3 MB
5. Use an image to create a Docker container:
docker run -i -t 8bfa335400c7 /bin/bash

Run Command,-iIt indicates interaction,-tRepresents a temporary terminal (Pseudo Terminal ),8bfa335400c7Is the image ID, that is, in step 4IMAGE ID, Use/bin/bash, Which means to usebashYou can start a Pseudo Terminal to interact with the container. The following warning is prompted during startup:

Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.

You can also go to Baidu to find a solution. After the service is started, it enters the docker container. Exit container:

exit

Or:

ctrl + d

After exiting, you can view all used containers:

docker ps -a

View the running container:

docker ps

I am not using this because a started container is disabled.-aThe command does not display the result. Use-aThe command displays the following results:

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES20342f7db4a9        8bfa335400c7        "/bin/bash"         14 minutes ago      Exited (0) 4 minutes ago                       mad_archimedes
6. re-enter the specified container:
docker start 20342f7db4a9

UsestartCommand, followed by the id value is the container ID value (ContainerID) found above, start and use the following command to enter:

docker attach 20342f7db4a9

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.