On the other day I installed Ansible. I'd like to try installing Docker by using Ansible.
I found this nice repository. I cannot thank enough to open source committers, they are my hero.
Also found the good article. This is written in 2014, but works in 2016!
Firstly, let's install the repository.
sudo ansible-galaxy install angstwad.docker_ubuntuThen change the hosts file. [local] is a group name.
vi /etc/ansible/hosts-127.0.0.1
+[local]
+localhost
Next, let's create my first Ansible playbook in yml.
vi /tmp/docker.yml- hosts: local
connection: local
roles:
- angstwad.docker_ubuntu
Then, execute ansible-playbook with the playbook
sudo ansible-playbook /tmp/docker.ymlDone! Docker is installed! I don't think this process can be easier!
docker --versionDocker version 1.12.1, build 23cf638
Run Ubuntu with Docker. This sounds little odd, because I am running Ubuntu Docker Image on Ubuntu in VirtualBox.
sudo docker pull ubuntu
sudo docker run -it ubuntuAnd it worked!
Make a directory on ubuntu on Docker
mkdir ~/testExit
exitRe-login
sudo docker run -it ubuntulsYou can see there is no test you made.
sudo docker ps -a
You can save the state with docker commit
Delete a docker image
docker rmi -f <image_name>
Delete all docker containers
sudo docker rm `sudo docker ps -a -q`
I deleted all containers, but can easily get the new container. This is the Try and Destroy environment!
sudo docker pull ubuntu:)