Mar 22, 2014

docker on Fedora 20

Docker is  a kind of virtualization software, feeling a little bit like zones in
Solaris.

In the REPO for Fedora 20, there is a package containing a lot of
examples for docker containers.

The package is named fedora-dockerfiles.noarch and put's its files into

[ewer@lxewer usr]$ cd /usr/share/fedora-dockerfiles/
[ewer@lxewer fedora-dockerfiles]$ ls
apache   firefox    mongodb  nginx   postgres  ssh
couchdb  memcached  mysql    nodejs  rabbitmq  wordpress_single_container

Building the first container:

cd /usr/share/fedora-dockerfiles/mysql
docker build -rm -t ewer/MySQL .


I had problems building the container, because I'm sitting behind a proxy to
the internet and the yum update failed. 

I added the following entry into /usr/lib/systemd/system/docker.service

EnvironmentFile=/etc/sysconfig/docker

into the section [Service]

the docker-Environment file /etc/sysconfig/docker contains:

HTTP_PROXY=http://<ip>:<port>                                          
http_proxy=$HTTP_PROXY
HTTPS_PROXY=$HTTP_PROXY
https_proxy=$HTTP_PROXY

export HTTP_PROXY HTTPS_PROXY http_proxy https_proxy

After restarting the docker-service

systemctl restart docker.service

the building of the container succeeded and it could be started:

docker run -d -p 3306:3306 <yourname>/MySQL

The README.md in the fedora-dockerfiles/mysql/README.md contains all the hints including the default password for mysql.

To get the IP adresse of the container execute

docker inspect <container_id> | grep -i ipaddr


and you can connect with the mysql client.


After stopping the container with

docker stop <Container-ID> 

where the container-ID is retrieved by

docker ps

you can restart the same container with

docker start <Container-ID> 

which you get with

docker ps -a

if the container is not up.


To attach to the container you can use lxc

docker ps -a --no-trunc
lxc-attach --name=<Full Container ID>

My current problem is, that the container doesn't start, if there is only the
WLAN adapter active and the physical LAN is not connected.