Build Docker-registry on Mac server (GO)

Source: Internet
Author: User
Tags docker run docker registry

build docker-registry on Mac server
2014-03-14 0 Comments Source: Build Docker-registry collection on Mac server
I want to contribute
.
This article describes how to build Docker's registry under Mac, we download Docker images very slowly in the country, so it is very necessary to build a base registry for the team, and Docker in Mac is actually run on a virtual machine, So if you want to persist in the registry in a few steps, the first to associate the virtual machine and the host disk, followed by the Docker registry image storage to be associated with the virtual machine mounted disk, so that the files in the Docker to penetrate the host, This article provides a complete overview of the entire installation deployment process. Installing homebrew

If you have already installed please skip the details, see http://brew.sh/

Please confirm that you have installed Xcode command line tools and VirtualBox

Ruby-e "$ (curl-fssl https://raw.github.com/Homebrew/homebrew/go/install)"
Update Homebrew

To ensure that there is a Boot2docker installation script

brew update
Installing Boot2docker
brew install boot2docker
Initialize Boot2docker
boot2docker init

The address of the docker_host needs to be set to tcp://127.0.0.1:4243 when initialization is complete

export DOCKER_HOST=tcp://127.0.0.1:4243

For convenience, you can add this information directly to the ~/.bash_profile, so you don't have to export every time

To map a port in a virtual machine to a host port

Run on the command line

VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port5000,tcp,,5000,,5000";
Start Boot2docker
boot2docker start

Variable parameters for export docker will be prompted after startup

Mount Host Disk

To ensure that the data is not lost, try to map useful data to the actual disk, so that even if the virtual machine disk is damaged, you can restore the warehouse data later

1. Install Osxfuse and SSHFS on the MAC host

: Http://osxfuse.github.io

2. Create the file ~/.boot2docker/b2d-passwd on the MAC host and save the Boot2docker ssh password in this file, the default is Tcuser

3. Execute the following command in the Boot2docker virtual machine

can be accessed via Boot2docker SSH

sudo mkdir /mnt/sda1/sharesudo chown -R docker:docker /mnt/sda1/share

4. Perform the following instructions on the MAC host

sshfs [email protected]:/mnt/sda1/share /docker/share -oping_diskarb,volname=share -p 2022 -o reconnect -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o password_stdin < ~/.boot2docker/b2d-passwd

5. In the Boot2docker virtual machine, execute the following command to create two directories for storing warehouse data configuration information

Can be modified according to your actual situation

mkdir /mnt/sda1/share/registrymkdir /mnt/sda1/share/registry-config

If you want to cancel the mount, execute it on your Mac

umount -f /docker/share

The mapping method for disks comes from https://github.com/boot2docker/boot2docker/issues/188

Download registry images using Docker
docker pull registry

Download image the best VPN first, you know.

Setting the config file for registry
dev:    loglevel: info    storage: local    storage_path: /mnt/registry
Start Registry
docker run -d -p 5000:5000 -v /mnt/sda1/share:/mnt -e DOCKER_REGISTRY_CONFIG=/mnt/registry-config/config.yml registry

Build Docker-registry on Mac server (GO)

Related Article

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.