Brief docker tutorial (taking wget program installation as an example)

Source: Internet
Author: User
Tags docker ps
Plan:
  • 1. Install docker (centos)
  • 2. register an account on the official docker website
  • 3. Download the basic centos image, install the required software and environment, and then push it to your Repository

 

1. Install docker (centos)

Select your own epel source in https://fedoraproject.org/wiki/EPEL#How_can_ I _use_these_extra_packages.3F.

Next, install docker-io:

$ sudo yum install docker-io

Start docker daemon:

$ sudo service docker start

Set docker to boot:

$ sudo chkconfig docker on

Download the latest Basic centos:

$ sudo docker pull centos:latest

Test whether centos runs successfully:

$ sudo docker images centos
2. register an account on the official docker website

Registering your own docker repository account is equivalent to opening up an image repository, equivalent to GitHub:

Https://hub.docker.com/account/signup/

3. Download others' images, make modifications, and push them to your own repository

The following is an example. After wget is installed in Image: centos, it is submitted to its own repository:

Enter the operation interface

[[email protected]113058 ~]# sudo docker run -i -t centos /bin/bashbash-4.2#

Install wget and exit after installation:

bash-4.2# yum install wgetbash-4.2#exit

View your modification records:

[[email protected]113058 ~]# docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES5f962b864221 centos:latest /bin/bash 2 minutes ago Exited (0) 42 seconds ago goofy_mcclintock 36f07f440c17 centos:latest /bin/bash 38 minutes ago Exited (0) 35 minutes ago boring_kowalevski 38e000fbee87 centos:latest /bin/bash 41 minutes ago Exited (127) 40 minutes ago sleepy_yonath

We can see that we recently submitted 5f962b864221, which is the image with wget installed and pushed it to our repository. There are three steps:

[[email protected]113058 ~]# docker commit 5f962b864221 alexknight/centos-wget

Alexknight is the name of the space opened in the warehouse. Next, you can log on to your account.

[[Email protected] 113058 ~] # Docker login-U "name registered in step 2"-P "passwd"-e "email address"

After logging on successfully, push your own submission

[[email protected]113058 ~]# docker push alexknight/centos-wget

If centos-wget is displayed on the page, the operation is successful.

Download the self-submitted centos-wget:

[[email protected]113058 ~]# docker pull alexknight/centos-wgetPulling repository alexknight/centos-wgetaa194d98cc9e: Download complete 511136ea3c5a: Download complete 34e94e67e63a: Download complete 1a7dc42f78ba: Download complete

When you enter your centos-wget for continuous submission again:

[[email protected]113058 ~]#sudo docker run -i -t alexknight/centos-wget /bin/bash

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.