For people in the meetup to try the Clear Containers hands on exercise on their own
You can try the hands on either in a VM using ciao-down or directly on your host system
First setup a clear containers virtual machine on Ubuntu/fedora using the instructions here https://github.com/01org/cc-oci-runtime/blob/master/documentation/Quickstart-Clear-Containers-in-a-Ubuntu-VM.md
If you want to try clear containers on bare metal, you choose to directly install clear containers on your host system directly
Ubuntu: https://github.com/01org/cc-oci-runtime/blob/master/documentation/Installing-Clear-Containers-on-Ubuntu.md Centos: https://github.com/01org/cc-oci-runtime/blob/master/documentation/Installing-Clear-Containers-on-Centos-7.md
Then setup three connections into the virtual machine
- Open 3 terminal sessions
- ciao-down connect or ssh in all three of these terminals will get you inside the VM
-
Check that clear containers has been installed.
systemctl status docker
This will show you default runtime is cor. Which the clear container runtime
-
In Terminal 1, run an alpine continer
docker run -it alpine sh
-
In terminal 2, run a debian container
docker run -it debian bash
-
Get the IP Addresses of each container in the terminal
ip a
-
Ping one container from the other
-
On terminal 3
ps auxw | grep qemu
This will give you all the details of the qemu invocation
-
On terminal 3
docker network inspect bridge
This will give you the IP and MACs as docker setup for these containers. They will match the information you saw in step 3
- Cleanup
Exit from containers in terminal 1 and 2 using exit
-
In Terminal 1
docker swarm init docker service create --name testswarm --replicas 1 --publish 8080:80 nginx /bin/bash -c "hostname > /usr/share/nginx/html/hostname; nginx -g \"daemon off;\"" docker service ls
Note: Wait till the service is up and running
-
In terminal 2
unset http_proxy curl 127.0.0.1:8080/hostname curl 127.0.0.1:8080/hostname curl 127.0.0.1:8080/hostname
You will see the same hostname reported back from the service
-
In terminal 1
docker service scale testswarm=3 docker service ls
Note: Wait till service ls show all replicas up and running
-
In terminal 2
curl 127.0.0.1:8080/hostname curl 127.0.0.1:8080/hostname curl 127.0.0.1:8080/hostname
Now you will see 3 different hostnames as the load gets balanced across the three replicas
You can scale it up more and see this continue
-
Inspect the service
docker service inspect
-
To cleanup
docker swarm leave --force
Note: If the swarm exercise does not work downgrade docker to 1.12.1