Wiki

Clone wiki

Documentation / Docker Setup

1. One-shot

1.1. Prepare your System

See also: https://docs.docker.com/mac/step_one/

On Max OS X we gonna install Docker Toolbox. Use the graphical installer as shown in the tutorial.

Finally we a ready to use Docker, Docker Machine and Docker Compose.

1.2. First run

create default docker-machine. Open the Launchpad and locate the Docker Quickstart Terminal icon. Click it.

1.3. Install Dependencies

We need Composer for TYPO3 and Shopware installation. So let's install it right away.

#!bash
# How can I install composer globally?
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

2. Daily business

2.1. Use docker-machine default

Because the Docker Engine daemon uses Linux-specific kernel features, you can’t run Docker Engine natively in OS X. Instead, you must use the Docker Machine command, docker-machine, to create and attach to a small Linux VM on your machine. This VM hosts Docker Engine for you on your Mac.

2.1.1. Start Docker Machine

First start the default docker-machine. You can see the VM running in VirtualBox.

#!bash
# Start the default machine
$ docker-machine start

2.1.2. Get and set environment for your docker-machine

To use the machine in your bash, the bash needs to know the docker-machine env.

#!bash

# When do I have to set environment?
# - Everytime you open a new shell
# - Everytime you change the network (WLAN, LAN etc.)

# How do I get the environment? 
$ docker-machine env default

# How do I set the environment?
$ eval $(docker-machine env default)

2.1.3. Get the IP of your machine

To use the machine get its IP

#!bash
# How do I get the ip of my running default machine?
$ docker-machine ip

2.1.4. Stop the machine

#!bash
# How do I stop default docker-machine
$ docker-machine stop

# How do I stop all running containers
$ docker stop $(docker ps -a -q)

2.2. Create a PHP project

Create a project to work with ;)

#!bash

# clone teufels boilerplate
$ git clone --recursive https://bitbucket.org/teufels/php_boilerplate_df.git projectname

# cd into projectname
$ cd projectname

# delete .git cause we do not wanna push into the boilerplate from within our project
$ rm -rf .git 

# first run container(s)
$ docker-compose up -d

2.3. Use Docker in your project

#!bash

# cd into project
$ cd projectname

# start (stopped) container(s)
$ docker-compose start

# stop container(s)
$ docker-compose stop

# show stopped or running container(s) in current project
$ docker-compose ps

# show all running container(s) globally
$ docker ps 

2.4 Install TYPO3 via composer

#!bash

# cd into project
$ cd projectname

# cd into app folder
$ cd app

# get TYPO3, **teufels-** and default extensions
$ composer install

# update project if extensions change (need t be updated)
# make sure to disable extensions in extension manager **first**
$ composer update

# install TYPO3
# Follow instructions in your browser
# db: dev, user: dev, pwd: <default>, host: mysql

# install **teufels-** and default extensions
# don't forget to create _cli_lowlevel backenduser **first**
$ make -f Makefile.teufels install-extensions

Additional information

Help

#!bash

# docker
$ docker --help

# docker-machine
$ docker-machine --help

# docker-compose
$ docker-compose --help

Basic docker commands

#!bash

# docker info
$ docker info

# show docker images
$ docker images

Remove untagged images

#!bash

$ docker rmi $(sudo docker images | grep '^<none>' | awk '{print $3}')

# bei ah
$ docker rmi -f $(docker images | grep "^<none>" | awk "{print $3}")

Additional Packages

wkhtmltopdf 0.10.0 rc1

#!bash

# call wkhtmltopdf
$ /usr/local/bin/wkhtmltopdf

Updated