update to newer version of docker and docker-registry
Change-Id: Ib120f3f0336e7a0ada1e3d468ca061d810660412
This commit is contained in:
parent
aadd2609c1
commit
433db2755c
|
@ -56,7 +56,7 @@
|
|||
args:
|
||||
chdir: "/data/registry/repositories/{{ tenant_id.stdout_lines[0] }}"
|
||||
register: command_result
|
||||
failed_when: "'Successfully built' not in command_result.stdout"
|
||||
failed_when: "'sha256:' not in command_result.stdout"
|
||||
|
||||
- name: Push the image to the global registry
|
||||
command: "docker push {{ hostvars[groups['docker'][0]]['inventory_hostname'] }}:{{ docker_registry_port }}/{{ tenant_id.stdout_lines[0] }}"
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
args:
|
||||
chdir: "/data/registry/repositories/{{ tenant_id.stdout_lines[0] }}"
|
||||
register: command_result
|
||||
failed_when: "'Successfully built' not in command_result.stdout"
|
||||
failed_when: "'sha256:' not in command_result.stdout"
|
||||
|
||||
- name: Push the image to the global registry
|
||||
command: "docker push {{ hostvars[groups['docker'][0]]['inventory_hostname'] }}:{{ docker_registry_port }}/{{ tenant_id.stdout_lines[0] }}"
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
args:
|
||||
chdir: "/data/registry/repositories/default_tenant_image"
|
||||
register: command_result
|
||||
failed_when: "'Successfully built' not in command_result.stdout"
|
||||
failed_when: "'sha256:' not in command_result.stdout"
|
||||
|
||||
- name: Push the default_tenant_image into the repository
|
||||
command: "docker push {{ inventory_hostname }}:{{ docker_registry_port }}/{{ tenant_id.stdout_lines[0] }}"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
args:
|
||||
chdir: "/data/registry/repositories/{{ base_os_image }}_{{ layer_suffix }}"
|
||||
register: command_result
|
||||
failed_when: "'Successfully built' not in command_result.stdout"
|
||||
failed_when: "'sha256:' not in command_result.stdout"
|
||||
|
||||
- name: Push the Image {{ layer_suffix }} in the repository
|
||||
command: "docker push {{ inventory_hostname }}:{{ docker_registry_port }}/{{ base_os_image }}_{{ layer_suffix }}"
|
||||
|
|
|
@ -17,14 +17,14 @@ FROM {{ inventory_hostname }}:{{ docker_registry_port }}/ubuntu_14.04
|
|||
|
||||
MAINTAINER {{ base_image_maintainer }}
|
||||
|
||||
# The following operations shoud be defined in one line
|
||||
# The following operations should be defined in one line
|
||||
# to prevent docker images from including apt cache file.
|
||||
RUN apt-get update && \
|
||||
apt-get install python -y && \
|
||||
apt-get install software-properties-common -y && \
|
||||
add-apt-repository ppa:webupd8team/java && \
|
||||
apt-get update && \
|
||||
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections && \
|
||||
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
|
||||
apt-get install oracle-java8-installer -y && \
|
||||
apt-get clean
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
- shell: dpkg --get-selections | grep linux-image-extra | wc -l
|
||||
register: linux_image_extra
|
||||
|
||||
- shell: dpkg --get-selections | grep lxc-docker | awk {'print $2'} | grep -w install | wc -l
|
||||
register: lxc_docker
|
||||
- shell: dpkg --get-selections | grep docker-engine | awk {'print $2'} | grep -w install | wc -l
|
||||
register: docker_engine
|
||||
|
||||
- command: uname -r
|
||||
register: uname
|
||||
|
@ -32,21 +32,21 @@
|
|||
when: "'0' in aufs.stdout_lines[0]"
|
||||
|
||||
- name: Set Docker Ubuntu Repo Key
|
||||
apt_key: keyserver=hkp://keyserver.ubuntu.com:80 id=36A1D7869245C8950F966E92D8576A8BA88D21E9 state=present
|
||||
apt_key: keyserver=hkp://p80.pool.sks-keyservers.net:80 id=58118E89F3A912897C070ADBF76221572C52609D state=present
|
||||
ignore_errors: True
|
||||
when: "'0' in lxc_docker.stdout_lines[0]"
|
||||
when: "'0' in docker_engine.stdout_lines[0]"
|
||||
|
||||
- name: Install Apt Transport HTTPS
|
||||
apt: name=apt-transport-https state=present update-cache=yes force=yes
|
||||
when: "'0' in lxc_docker.stdout_lines[0]"
|
||||
when: "'0' in docker_engine.stdout_lines[0]"
|
||||
|
||||
- name: Add Docker Apt repository
|
||||
apt_repository: repo='deb http://get.docker.io/ubuntu docker main' state=present
|
||||
when: "'0' in lxc_docker.stdout_lines[0]"
|
||||
apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-trusty main' state=present
|
||||
when: "'0' in docker_engine.stdout_lines[0]"
|
||||
|
||||
- name: Install Docker Client
|
||||
apt: name=lxc-docker state=present update-cache=yes force=yes
|
||||
when: "'0' in lxc_docker.stdout_lines[0]"
|
||||
apt: name=docker-engine state=present update-cache=yes force=yes
|
||||
when: "'0' in docker_engine.stdout_lines[0]"
|
||||
|
||||
# There seem to be a bug in the installation where config files are not installed.
|
||||
# Might be a bug in the un-install where docket thinks it is upgrading.
|
||||
|
|
|
@ -13,99 +13,8 @@
|
|||
# Limitations under the License.
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
- name: Install dependencies
|
||||
apt:
|
||||
pkg: "{{ item }}"
|
||||
with_items:
|
||||
- git
|
||||
- build-essential
|
||||
- libevent-dev
|
||||
- libssl-dev
|
||||
- liblzma-dev
|
||||
- python-dev
|
||||
|
||||
- stat: path=/usr/bin/pip
|
||||
register: p
|
||||
- get_url: url="https://raw.githubusercontent.com/pypa/pip/5d927de5cdc7c05b1afbdd78ae0d1b127c04d9d0/contrib/get-pip.py"
|
||||
when: not p.stat.exists
|
||||
- shell: python get-pip.py
|
||||
when: not p.stat.exists
|
||||
- file: src=/usr/local/bin/pip dst=/usr/bin/pip state=link
|
||||
when: not p.stat.exists
|
||||
|
||||
|
||||
- name: Git clone and checkout the Docker repository service code
|
||||
stat: path=/opt/docker-registry
|
||||
register: p
|
||||
- git:
|
||||
repo: https://github.com/dotcloud/docker-registry.git
|
||||
dest: /opt/docker-registry
|
||||
version: 0.6.3
|
||||
when: not p.stat.exists
|
||||
|
||||
- shell: chdir=/opt/docker-registry
|
||||
/bin/sed -i '/keystoneclient/d' requirements.txt
|
||||
|
||||
- shell: chdir=/opt/docker-registry
|
||||
/bin/sed -i '/swiftclient/d' requirements.txt
|
||||
|
||||
- shell: chdir=/opt/docker-registry
|
||||
/bin/sed -i '/requests/d' requirements.txt
|
||||
|
||||
- shell: chdir=/opt/docker-registry
|
||||
/bin/sed -i '/glanceclient/d' requirements.txt
|
||||
|
||||
- name: pip install the Docker repository service requirements
|
||||
pip:
|
||||
chdir: /opt/docker-registry
|
||||
requirements: requirements.txt
|
||||
|
||||
- name: Create log dir
|
||||
file:
|
||||
path: /var/log/docker-registry
|
||||
state: directory
|
||||
mode: 0755
|
||||
owner: root
|
||||
|
||||
- name: Create data dir
|
||||
file:
|
||||
path: /data/registry
|
||||
state: directory
|
||||
mode: 0755
|
||||
owner: root
|
||||
|
||||
- name: Create repository service config file
|
||||
stat: path=/opt/docker-registry/config/config.yml
|
||||
register: st0
|
||||
|
||||
- template:
|
||||
src: opt/docker-registry/config/config.yml
|
||||
dest: /opt/docker-registry/config/config.yml
|
||||
owner: root
|
||||
mode: 0644
|
||||
when: not st0.stat.exists
|
||||
|
||||
- name: Create Docker repository service upstart job
|
||||
stat: path=/etc/init/docker-registry.conf
|
||||
register: st1
|
||||
|
||||
- template:
|
||||
src: etc/init/docker-registry.conf
|
||||
dest: /etc/init/docker-registry.conf
|
||||
owner: root
|
||||
mode: 0644
|
||||
when: not st1.stat.exists
|
||||
|
||||
- name: Stop docker repository service
|
||||
service:
|
||||
name: docker-registry
|
||||
state: stopped
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Start Docker repository service
|
||||
service:
|
||||
name: docker-registry
|
||||
state: started
|
||||
shell: docker run -d -p {{ docker_registry_port }}:5000 -v /var/lib/registry:/var/lib/registry --name registry registry:2
|
||||
|
||||
- name: Test repository
|
||||
shell: docker images | grep my_busybox | wc -l
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
description "Docker Registry"
|
||||
version "0.6.3"
|
||||
author "Docker, Inc."
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
|
||||
respawn
|
||||
respawn limit 10 5
|
||||
|
||||
# set environment variables
|
||||
env REGISTRY_HOME=/opt/docker-registry
|
||||
|
||||
# At this point we use dev so as not to use redis.
|
||||
env SETTINGS_FLAVOR=dev
|
||||
|
||||
script
|
||||
cd $REGISTRY_HOME
|
||||
exec gunicorn -k gevent --max-requests 100 --graceful-timeout 3600 -t 3600 -b 0.0.0.0:{{ docker_registry_port }}\
|
||||
-w 8 --access-logfile /var/log/docker-registry/access.log --error-logfile /var/log/docker-registry/server.log\
|
||||
wsgi:application
|
||||
end script
|
|
@ -1,40 +0,0 @@
|
|||
#---------------------------------------------------------------------------
|
||||
# Copyright IBM Corp. 2015, 2015 All Rights Reserved
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# Limitations under the License.
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The 'common' part is automatically included (and possibly overriden by
|
||||
# all other flavors)
|
||||
common:
|
||||
# Set a random string here
|
||||
secret_key: "{{ docker_registry_random_string }}"
|
||||
standalone: true
|
||||
# This is the default configuration when no flavor is specified
|
||||
dev:
|
||||
storage: local
|
||||
storage_path: /data/registry
|
||||
loglevel: debug
|
||||
# To specify another flavor, set the environment variable SETTINGS_FLAVOR
|
||||
# $ export SETTINGS_FLAVOR=prod
|
||||
prod:
|
||||
storage: local
|
||||
storage_path: /data/registry
|
||||
loglevel: info
|
||||
# Enabling LRU cache for small files. This speeds up read/write on
|
||||
# small files when using a remote storage backend (like S3).
|
||||
cache:
|
||||
host: localhost
|
||||
port: 6379
|
||||
cache_lru:
|
||||
host: localhost
|
||||
port: 6379
|
|
@ -25,7 +25,7 @@
|
|||
args:
|
||||
chdir: "/data/registry/repositories/{{ base_os_image }}_{{ layer_suffix }}"
|
||||
register: command_result
|
||||
failed_when: "'Successfully built' not in command_result.stdout"
|
||||
failed_when: "'sha256:' not in command_result.stdout"
|
||||
|
||||
- name: Push the Image {{ layer_suffix }} in the repository
|
||||
command: "docker push {{ inventory_hostname }}:{{ docker_registry_port }}/{{ base_os_image }}_{{ layer_suffix }}"
|
||||
|
|
|
@ -13,40 +13,10 @@
|
|||
# Limitations under the License.
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
- stat: path=/opt/docker-registry
|
||||
register: st
|
||||
|
||||
- name: Stop Docker repository service
|
||||
service: name=docker-registry state=stopped
|
||||
when: st.stat.exists
|
||||
- name: Stop Docker repository container
|
||||
shell: docker stop registry
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Uninstall repo dependencies
|
||||
pip:
|
||||
chdir: /opt/docker-registry
|
||||
requirements: requirements.txt
|
||||
state: absent
|
||||
when: st.stat.exists
|
||||
|
||||
- name: Remove log dir
|
||||
stat: path=/var/log/docker-registry
|
||||
register: p
|
||||
- shell: rm -fr /var/log/docker-registry
|
||||
when: p.stat.exists
|
||||
|
||||
- name: Remove data dir
|
||||
stat: path=/data/registry
|
||||
register: p
|
||||
- shell: rm -fr /data/registry
|
||||
when: p.stat.exists
|
||||
|
||||
- name: Delete repository code
|
||||
stat: path=/opt/docker-registry
|
||||
register: p
|
||||
- shell: rm -fr /opt/docker-registry
|
||||
when: p.stat.exists
|
||||
|
||||
- name: Delete Docker repository service upstart job
|
||||
stat: path=/etc/init/docker-registry.conf
|
||||
- shell: rm -fr /etc/init/docker-registry.conf
|
||||
when: p.stat.exists
|
||||
- name: Remove Docker repository container
|
||||
shell: docker rm registry
|
||||
ignore_errors: yes
|
||||
|
|
Loading…
Reference in New Issue