[Getting started] Docker on C1 (armhf)


#1

This page shows you how Docker run on the C1 servers.

The Docker works as everywhere, but you won’t be able to run i386/amd64 built images.


Update: our docker namespace prefix switched from onlinelabs to armbuild


Important note:

The docker registry mainly contains i386/amd64 images that won’t run on C1 servers.
Also if you create some images on C1 servers, please be nice with the docker registry and think to prefix your image name with “armhf-”.


Basic commands

  • docker search armhf: search the registry for all repos matching *armhf*
  • docker pull armbuild/ubuntu: Pull our armhf port of the official ubuntu repos
  • docker run -i -t armbuild/ubuntu bash: "Start a container of armbuild/ubuntu and run a bash

Armhf images:

We prebuilt some of the most downloaded images for armhf architecture.

Also you can search for other armhf/armel images with

  • sudo docker search armhf or
  • sudo docker search armel

We renamed repos following this :

  • ubuntu -> armbuild/ubuntu
  • busybox -> armbuild/busybox
  • dockerfile/ubuntu -> armbuild/dockerfile-ubuntu

We also created an armhf-prefix tag for each images

root@c1-10-1-15-34:~# docker search armbuild | sort
NAME                                       DESCRIPTION   STARS     OFFICIAL   AUTOMATED
armbuild/ubuntu                                  0
armbuild/debian                          0
...

Examples:

Run a debian container fetched from official Docker registry.

root@c1-10-1-6-11:~# docker run -it armbuild/debian bash
Unable to find image 'armbuild/debian' locally
Pulling repository armbuild/debian
695aba5af5de: Download complete
511136ea3c5a: Download complete
c9077ec908f5: Download complete
root@7e5dd2e973db:/# cat /etc/debian_version
7.7

Run a busybox container

root@c1-10-1-6-11:~# docker run -it armbuild/busybox sh
Unable to find image 'armbuild/busybox' locally
Pulling repository armbuild/busybox
d91e5575e4cc: Download complete
511136ea3c5a: Download complete
73089b67ca16: Download complete
BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/ # help
Built-in commands:
------------------
        . : [ [[ alias bg break cd chdir command continue echo eval exec
        exit export false fg getopts hash help jobs kill let local printf
        ...

Build a custom image

root@c1-10-1-15-34:~/cow# cat Dockerfile
FROM armbuild/ubuntu:latest
RUN apt-get install -y -q cowsay
ENTRYPOINT ["/usr/games/cowsay"]
root@c1-10-1-15-34:~/cow# docker build -t armbuild/example-cowsay .
Sending build context to Docker daemon 3.584 kB
Sending build context to Docker daemon
Step 0 : FROM armbuild/ubuntu:latest
 ---> 7ae58afd9325
Step 1 : RUN apt-get install -y -qq cowsay
 ---> Running in f05d2c8c9ed5
... skipped ...
 ---> 3a542de68938
Removing intermediate container f05d2c8c9ed5
Step 2 : ENTRYPOINT ["cowsay"]
 ---> Running in c8173db00e74
 ---> Running in c8173db00e74
 ---> d36aa96d224d
Removing intermediate container c8173db00e74
Successfully built d36aa96d224d
root@c1-10-1-15-34:~/cow# docker run -i -t armbuild/example-cowsay Woot
 ______
< Woot >
 ------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
root@c1-10-1-15-34:~/cow#

Run the official wordpress container with dockerfile/mysql

Images:

Steps:

Install dockerfile/mysql:

root@c1-10-1-15-34:~/$ docker run -d --name mysql armbuild/dockerfile-mysql
Unable to find image 'armbuild/dockerfile-mysql' locally
Pulling repository armbuild/dockerfile-mysql
c6e45a3df6be: Download complete
*** skipping ***
a544fc4a439b: Download complete

d649362aec8706a5448053ec96699ea52a871bfec93b0ae15c9dbfec29f0be89

Check if the container is running

root@c1-10-1-15-34:~/$ docker ps
CONTAINER ID        IMAGE                                COMMAND             CREATED             STATUS              PORTS               NAMES
d649362aec87        armbuild/dockerfile-mysql:latest   "mysqld_safe"       15 seconds ago      Up 11 seconds       3306/tcp            mysql

Create wp database

root@c1-10-1-15-34:~# docker run -it --rm --link mysql:mysql armbuild/dockerfile-mysql bash -c 'mysql -h $MYSQL_PORT_3306_TCP_ADDR'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database wordpress; grant all privileges on wordpress.* to 'wp'@'%' identified by 'wp';
Query OK, 1 row affected (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
mysql>

Install wordpress

root@c1-10-1-15-34:~/cow# docker run --name wordpress --link mysql:mysql -e WORDPRESS_DB_USER=wp -e WORDPRESS_DB_PASSWORD=wp -p 80:80 -d armbuild/wordpress
b0737582b62249cc04cf94b5ac588d1b3040af8fd37c79f30122d338e646e89d
root@c1-10-1-15-34:~/cow# docker ps
CONTAINER ID        IMAGE                                COMMAND                CREATED             STATUS              PORTS                NAMES
b0737582b622        armbuild/wordpress:latest          "/entrypoint.sh apac   11 seconds ago      Up 7 seconds        0.0.0.0:80->80/tcp   wordpress
d649362aec87        armbuild/dockerfile-mysql:latest   "mysqld_safe"          23 minutes ago      Up 23 minutes       3306/tcp             mysql,wordpress/mysql

Check the install

root@c1-10-1-15-34:~# curl -i 212.47.228.14
HTTP/1.1 302 Found
Location: http://212.47.228.14/wp-admin/install.php
...

Open http://212.47.228.14/wp-admin/install.php in your browser


Convert an image to armhf

Basic example:

In this example the only non-armhf thing is the FROM image, luckily, we already built it for armhf.

So you need :

  • To replace FROM dockerfile/ubuntu with FROM armbuild/dockerfile-ubuntu
  • To build the image docker build -t armbuild/dockerfile-python .
  • Test your build: docker run -i -t armbuild/armhf-dockerfile-python python
root@c1-10-1-15-34:~/cow# docker run -i -t armbuild/armhf-dockerfile-python python
Python 2.7.6 (default, Mar 22 2014, 23:30:12)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'woot'
woot
>>>

Tips

  • Replace the FROM with an inliner bash

sed -i ‘s|^FROM |FROM armbuild/armhf-|g’ Dockerfile


---

Links
-------------------

- **Official server image**:

https://community.cloud.online.net/t/official-new-linux-distributions-debian-coreos-centos-fedora-arch-linux/229/21?u=manfred

- Docker documentation: http://docs.docker.com
- Docker registry: https://registry.hub.docker.com
- Online Labs official images: https://registry.hub.docker.com/repos/armbuild/

[OFFICIAL] Docker support
[OFFICIAL] Docker support
#2

Thanks for the image. This is the only image i’l ever need :smiley: anything else will run in containers.

I just created a docker 1.3.0 binary. I’ve dockerized it, so the upgrade is as easy as:

docker run --rm -v /usr/bin:/target sequenceiq/armhf-docker-install:1.3.0

unfortunately service docker restart didnt work, so i just restarted the server.


#3

There is also a Docker 1.3 binary in my repo


#4

Fixed for the next release


#5

We switched to a new docker organization: armbuild

Ie:

➜  ~  docker search armbuild
armbuild/ubuntu
armbuild/debian
armbuild/busybox
armbuild/registry
armbuild/ubuntu-debootstrap
armbuild/stackbrew-ubuntu
armbuild/wordpress
armbuild/phusion-baseimage
armbuild/dockerfile-java
armbuild/ubermuda-docker-wordpress
armbuild/dockerfile-ubuntu
armbuild/guilhem-vagrant-ubuntu
armbuild/orchadup-postgresql
armbuild/orchardup-mysql
armbuild/moul-python-dev
armbuild/moul-emacs
armbuild/maxexcloo-openvpn
armbuild/training-postgres
armbuild/rstiller-wordpress
armbuild/moul-tmux
armbuild/tutum-curl
armbuild/armel-ubuntu
armbuild/tpires-neo4j
armbuild/sameersbn-ubuntu
armbuild/orchardup-postgresql
armbuild/moul-sshd
armbuild/moul-shellinabox
armbuild/moul-qemu-user
armbuild/maxexcloo-sickbeard
armbuild/maxexcloo-sabnzbd
armbuild/maxexcloo-readymedia
armbuild/maxexcloo-openssh
armbuild/maxexcloo-minecraft
armbuild/centurylink-apache-php
armbuild/dockerfile-celery
armbuild/dockerfile-supervisor
armbuild/dockerfile-ruby
armbuild/dockerfile-python
armbuild/dockerfile-nodejs
armbuild/dockerfile-go
armbuild/buildpack-deps
armbuild/cpuguy83-ruby-buildpack
armbuild/steeve-cross-compiler
armbuild/guilhem-jenkins-slave
armbuild/shift-coreos-openhab
armbuild/joaodubas-openjdk
armbuild/joaodubas-oracle-jdk
armbuild/crosbymichael-mono
armbuild/centurylink-wordpress
armbuild/centurylink-drupal
armbuild/centurylink-openssl
armbuild/jcherqui-docker-piwik
armbuild/tutum-apache-php
armbuild/armhf-ubuntu-debootstrap
armbuild/dockerfile-rabbitmq
armbuild/dockerfile-redis
armbuild/dockerfile-mysql
armbuild/ulexus-qemu-bootstrap
armbuild/ulexus-qemu
armbuild/moul-debootstrap-builder
armbuild/jpetazzo-nsenter
armbuild/jpetazzo-critmux
armbuild/crosbymichael-build-essential
armbuild/crosbymichael-cloud9
armbuild/jpetazzo-gunsub
armbuild/orchardup-php5
armbuild/orchardup-nginx
armbuild/moul-wowza
armbuild/moul-socat
armbuild/moul-scapy
armbuild/crosbymichael-htop
armbuild/crosbymichael-htpasswd
armbuild/moul-node
armbuild/moul-liquidsoap
armbuild/moul-icecast
armbuild/maxexcloo-znc
armbuild/maxexcloo-subsonic
armbuild/maxexcloo-sniproxy
armbuild/maxexcloo-nodejs
armbuild/maxexcloo-java
armbuild/maxexcloo-dnsmasq
armbuild/maxexcloo-debian
armbuild/maxexcloo-couchpotato
armbuild/frodenas-ubuntu
armbuild/frodenas-java7
armbuild/frodenas-elasticsearch
armbuild/dockerfile-elasticsearch
armbuild/tutum-ubuntu
armbuild/dockerfile-ubuntu-desktop
armbuild/dockerfile-ruby-runtime
armbuild/dockerfile-python-runtime
armbuild/dockerfile-nsq
armbuild/dockerfile-nodejs-runtime
armbuild/dockerfile-go-runtime
armbuild/dockerfile-fpm
armbuild/dockerfile-ansible
armbuild/iserko-docker-celery-flower
armbuild/oskarhane-wordpress-nginx-ssh
armbuild/jpetazzo-squid-in-a-can

#6

I follow the tutorial here, and installed the wordpress image as described. But is it me, or this is super slow on the C1? I moved everything to the apache server outside the container, and things were way smoother… I kept the database on the mysql container, though.