20160331
I need install docker unstable version with testbed, so I write the note and ansible playbook with openSUSE Leap 42.1
OS: openSUSE Leap 42.1
Package: docker 1.10.x
docker in openSUSE Leap 42.1 is 1.9.x now.
How to query your docker version?
# zypper search -s --match-exact docker
Loading repository data...
Reading installed packages...
S | Name | Type | Version | Arch | Repository
--+--------+------------+------------+--------+--------------------------
| docker | package | 1.9.1-13.1 | x86_64 | openSUSE-Leap-42.1-Update
| docker | package | 1.9.1-10.1 | x86_64 | openSUSE-Leap-42.1-Update
| docker | package | 1.9.1-7.1 | x86_64 | openSUSE-Leap-42.1-Update
| docker | package | 1.9.0-4.1 | x86_64 | openSUSE-Leap-42.1-Update
| docker | package | 1.8.2-2.5 | x86_64 | openSUSE-Leap-42.1-Oss
- -s - detail, but not much than -v "verbose"
- --match-exact - match the package name
- like --match-words ^docker$
I want to install docker with batch mode or non-interactive
First idea
*Use OneClickInstallCLI with .ymp file
Here is the link
But OneClickInstallCLI can't use non-interactive mode -- Give up
Use blow method now
in software.opensuse.org search docker
click Virtualization:container
In project web page
Click Repositories
You could see each version repositories download
I use Leap 42.1 so click openSUSE_Leap 42.1 link, like
You could see the .repo file in web page
link is
Use zypper to add repo, key and setup auto refresh
# zypper --gpg-auto-import-keys addrepo -f http://download.opensuse.org/repositories/Virtualization:/containers/openSUSE_Leap_42.1/Virtualization:containers.repo
- --gpg-auto-import-keys - auto add repo key
- -f - auto refresh
Check your repos by zypper command
# zypper repos
# | Alias | Name | Enabled | GPG Check | Refresh
---+---------------------------+------------------------------------------------+---------+-----------+--------
1 | Virtualization_containers | Virtualization:containers (openSUSE_Leap_42.1) | Yes | ( p) Yes | Yes
2 | openSUSE-42.1-0 | openSUSE-42.1-0 | No | ---- | No
# zypper -n install docker
Loading repository data...
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 7 NEW packages are going to be installed:
bridge-utils docker docker-image-migrator git-core git-gui gitk perl-Error
The following recommended package was automatically selected:
docker-image-migrator
7 new packages to install.
Overall download size: 12.9 MiB. Already cached: 0 B. After the operation, additional 59.4 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package docker-image-migrator-1.0.2-7.1.x86_64
Set up docker start and boot enable
# systemctl status docker
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
Active: inactive (dead)
Docs: http://docs.docker.com
start docker service
# systemctl start docker
# systemctl status docker
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
Active: active (running) since Thu 2016-03-31 11:00:58 CST; 2s ago
Docs: http://docs.docker.com
Main PID: 32272 (docker)
CGroup: /system.slice/docker.service
└─32272 /usr/bin/docker daemon -H fd://
Set up boot enable
# systemctl is-enabled docker
disabled
enable start at boot
# systemctl enable docker
# systemctl is-enabled docker
enabled
-------------------------------------------------
I write ansible playbook .yml for insatll with ansible
You could get it at github
Here is my ansible playbook yml file
# cat docker_unstable_openSUSELeap42.1_install.yml
---
#########################################################
# Install docker package and setup boot with unstable repo in openSUSE Leap 42.1
- name: use when conditionals and setup module (facts)
hosts: all
tasks:
# 使用 setup moudule 列出 OS 種類
- name: use setup module to list os distribution
# setup moudle 可以使用 filter 過濾相關內容
setup: filter=ansible_distribution
#########################################################
- name: Install docker and run service
# use [dockerUnstable] group to install
hosts: dockerUnstable
sudo: True
tasks:
# Add Virtualization:container project repo
- name: Add Virutalization:containers repo
shell: zypper --gpg-auto-import-keys addrepo -f http://download.opensuse.org/repositories/Virtualization:/containers/openSUSE_Leap_42.1/Virtualization:containers.repo
- name: Install docker with openSUSE Leap
zypper: name={{ item }}
with_items:
- docker
- curl
when: ansible_distribution == "openSUSE Leap"
#-------------------------------------------------------
- name: Set docker enable and run
service: name=docker state=started enabled=yes
No comments:
Post a Comment