Last active
          March 2, 2016 08:55 
        
      - 
      
- 
        Save sheldonh/e3bb239dbf81586df641 to your computer and use it in GitHub Desktop. 
    Docker registry mirror systemd service unit file
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | [Unit] | |
| Description=Docker registry mirror | |
| After=docker.service | |
| Requires=docker.service | |
| [Service] | |
| Environment=UNIT=docker-registry-mirror | |
| TimeoutStartSec=0 | |
| ExecStartPre=/usr/bin/docker pull registry | |
| ExecStartPre=-/usr/bin/docker run --name ${UNIT}-dvc -v /tmp/registry busybox true | |
| ExecStartPre=-/usr/bin/docker rm ${UNIT} | |
| ExecStart=/usr/bin/docker run --name ${UNIT} \ | |
| -e MIRROR_SOURCE=https://registry-1.docker.io \ | |
| -e MIRROR_SOURCE_INDEX=https://index.docker.io \ | |
| -e MIRROR_TAGS_CACHE_TTL=2592000 \ | |
| -p 5000:5000 \ | |
| --volumes-from ${UNIT}-dvc \ | |
| registry | |
| ExecStop=/usr/bin/docker stop ${UNIT} | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment