Docker

From syn2cat - HackerSpace.lu
Revision as of 21:38, 1 February 2016 by Gunstick (Talk | contribs)

Jump to: navigation, search

My little page about getting docker to run, done by somebody having no idea what docker is.

Yeah, DAU-docker!

ATTENTION this uses default passwords, and is completely unsecure !!!!

First install docker

  • sudo apt-get install docker.io
  • sudo usermod -a -G docker $(id -un)
  • # logoout/login to get your group attribution


Mediawiki

Fist some settings

  • WEBPORT=8080 # on which port the webserver should listen on the main host, if you have already a webserver, 80 won't work
  • DBPASSWORD="$(openssl rand -base64 9)" # the password for the database (humm... save it :-)
  • DOCKERNAME="mediawiki"

Create a database

Create a mediawiki

Configure mediawiki

  • firefox http://localhost:$WEBPORT/
    • database host: mysql
    • database name: mysql
    • table prefix: mw
    • username: root
    • password: $DBPASSWORD
    • at end of setup you get a LocalSettings.php to download
    • this file has to be provided to the docker or put into the container. Seems to be several ways to do it, but none work. So this one works:
  • cat LocalSettings.php | docker exec -i some-mediawiki sh -c 'cat > /var/www/html/LocalSettings.php'
  • docker exec -i some-mediawiki chown www-data:www-data /var/www/html/LocalSettings.php
  • docker exec -i some-mediawiki chmod 444 /var/www/html/LocalSettings.php
  • firefox http://localhost:8080/index.php

More help: well the usual mediawiki help

Engelsystem

Give some configuration stuff

  • ENGELPORT=80 # on which port the engel system should listen on the main host, if you have a webserver, 80 won't work
  • ENGELDB=3306 # on which port the mysql of the engelsystem should be visible on the main host
  • DBPASSWORD="$(openssl rand -base64 9)" # the password for the database (humm... save it it :-)
  • ENGELPASSWORD="$(openssl rand -base64 9)" # the password for the engelsystem (humm... save it it :-)
  • DOCKERNAME="engelsystem"
  • ENGELADMIN="engeladmin" # well just use it

from https://github.com/ruep/dockerfile-engel

  • git clone https://github.com/ruep/dockerfile-engel.git
  • cd dockerfile-engel/
  • docker build -t engelweb-app . # this takes a long time
  • docker run --name "$DOCKERNAME" -d -p ${ENGELPORT}:80 -p ${ENGELDB}:3306 -e MYSQL_PASS="$DBPASSWORD" engelweb-app
  • docker exec -t "$DOCKERNAME" sed -i 's/-pengel/-p'$DBPASSWORD'/' /engelweb/db/createdb.sh # needed coz db pass hardcoded
  • docker exec -t "$DOCKERNAME" /engelweb/db/createdb.sh engelsystem engeladmin "$ENGELPASSWORD"
  • docker exec -t "$DOCKERNAME" sh -c "/usr/bin/mysql -uadmin -p$DBPASSWORD engelsystem < /engelweb/db/install.sql"
  • docker exec -t "$DOCKERNAME" sh -c "/usr/bin/mysql -uadmin -p$DBPASSWORD engelsystem < /engelweb/db/update.sql"
  • echo "Please remember the database password: $DBPASSWORD"
  • echo "Please remember the engelsystem login: ${ENGELADMIN} ${ENGELPASSWORD}"
  • echo login to http://localhost:$ENGELPORT/ with user 'admin' and password 'asdfasdf'
Personal tools
Namespaces

Variants
Actions
Navigation
syn2cat
Hackerspace
Activities
Initiatives
Community
Tools
Tools