UBUNTU16 Building Docker Private Library

Source: Internet
Author: User
Tags docker run

The test environment is as follows:

First, the installation of Docker

Installation method Please check the installation tutorial here

Second, set up ordinary users

  1. How to set up CentOS

$ sudo gpasswd-a Docker ${user}

  2. How to set up Ubuntu

$ sudo usermod-ag Docker ${user}

Third, the private library image download

 1. Create a directory Private library mount

$ sudo mkdir-p/data/registry$ Docker run-d-P 5000:5000-v/data/registry:/tmp/registry Registry

  2. View the downloaded image

$ docker Images

Iv. Configuration of the client

  1. Download BusyBox test image

$ Docker Pull BusyBox

2. Set the label for BusyBox to upload to the private library

$ docker Tag 172.16.1.206:5000/busybox

V. The current version of Docker uses the HTTPS protocol by default, and some configuration is required to use the local repository. This configuration is performed on the client.

1, modify the/etc/default/docker

$ sudo vim/etc/default/docker

"/etc/default/docker"

docker_opts= "--registry-mirror=http://xxxxxxxx.m.daocloud.io--insecure-registry 172.16.1.206:5000--dns 8.8.8.8-- DNS 8.8.4.4 "

#上述设置关键在于172.16.1.206:5000

2, modify the/lib/systemd/system/docker.service

# Vim/lib/systemd/system/docker.service

"/lib/systemd/system/docker.service" Environmentfile=/etc/default/docker //This sentence is new Execstart=-/usr/bin/dockerd -H fd://$DOCKER _opts //reference docker_opts

#切换到root
$ sudo-i

# Systemctl Daemon-reload

# Systemctl Restart Docker

 3. View the results of the changes

# The following command can be checked to see the docker_opts$ sudo systemctl status just set Docker.service

Vi. push mirroring to the local repository

$ docker Push 172.16.1.206:5000/busybox

UBUNTU16 Building Docker Private Library

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.