Skip to content

Commit

Permalink
Switch to Docker CE
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke committed Jul 18, 2017
1 parent b8095f0 commit 72427c2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
50 changes: 47 additions & 3 deletions provision/ansible/roles/docker/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,60 @@
---

- name: Install docker utils
- name: Install docker requirements
apt:
pkg: '{{ item }}'
state: present
with_items:
- curl
- aufs-tools
- apt-transport-https

- name: Install docker
- name: Uninstall old Docker versions
apt:
name: "{{ item }}"
state: absent
with_items:
- docker
- docker-engine
- docker.io

- name: Add Docker repository key
apt_key:
id: "9DC858229FC7DD38854AE2D88D81803C0EBFCD88"
keyserver: "https://download.docker.com/linux/ubuntu/gpg"
state: present
register: add_repository_key
ignore_errors: true

- name: Alternative | Add Docker repository key
shell: "curl -sSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -"
when: add_repository_key|failed

- name: Add Docker repository
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_lsb.id|lower }} {{ ansible_lsb.codename|lower }} stable"
update_cache: yes
state: present

- name: Install Docker CE
apt:
pkg: '{{ item }}'
state: latest
with_items:
- docker-engine
- docker-ce

- name: Deploy docker.service (template)
template:
src: templates/docker.service.j2
dest: /etc/systemd/system/docker.service
owner: vagrant
group: root
mode: 0775

- name: Restart Docker
command: '{{ item }}'
with_items:
- systemctl daemon-reload
- systemctl enable docker
- systemctl restart docker

2 changes: 1 addition & 1 deletion provision/ansible/roles/docker/templates/docker.service.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H unix:///var/run/docker.sock -H tcp://{{ VM.network.private.address }}:2375 {{ DOCKER.opts }}
ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://{{ VM.network.private.address }}:2375 {{ DOCKER.opts }}

0 comments on commit 72427c2

Please sign in to comment.