docker_image

Hands-On: Docker for Webdevelopers (WordPress & Laravel)

Von am 10.01.2017

Docker is an open platform, currently available in version 1.12, which provides the Docker Engine and the Docker Hub. The software is written in Go, a programming language developed by Google. The main features of the Docker platform are creating and working with Docker images and containers. Docker builds on Linux Containers, operating system virtualization, and a versioning and differencing system like Git.

Three components of Docker

Docker has three components: Docker images, Docker registries, and Docker containers.

Docker image

A Docker image is the template for a Docker container. It could for example consist of an operating system, a web server, a database, and your application installed. Docker images can be easily set upped and updated with the Docker software, but you can also download Docker images, which were created by other people.

Docker registries

Docker registries are public or private collections of Docker images. Docker Hub is the public registry from Docker. You are able to create your own private registry on a server, for example, for your own company.

Docker containers

A Docker container is basically a directory, which is generated from a Docker image. You are able to run, start, stop, move, or delete a container. Each Docker container is an isolated and secure platform with all things, which are needed for an application to run.

Goal of Docker

The goal of Docker is to solve the problem of “dependency hell”. When you put an application with all its dependencies in a Docker container, this application will be portable and isolated. Now you are able to run the application in different environments, like on your laptop, in a data center or maybe on a cloud service.

The dependency hell

Docker tries to solve problems with conflicting dependencies, missing dependencies, and platform differences.

  • Conflicting dependencies: For example, you run different web applications at one host operating system, but one application needs another PHP version than the other. With Docker this is no problem, because you could prepare one Docker container for each PHP version.
  • Missing dependencies: For example, you have developed an application on a local machine and this application requires a database, a web server and also some other dependencies. After finishing the development you install it in the testing environment. You have to set up all databases and the web server anew, but do not forget anything. Otherwise the application might not run. If you develop the application within a Docker container, you only have to move the container to the new environment; all databases, web servers, dependencies and so on are saved in the container.
  • Platform differences: You distribute your web application in the online environment of your company for example. You have developed your web application on your local machine, which runs Mac OS X, but your online environment is a Linux server. If you use Docker, this is no longer a dilemma. You just have to develop your application in a Docker container and the system administrator of your company has to install the Docker engine in the online environment.

 

Preparation for the Hands-On Sessions:

  • Install Docker Toolbox – Link
  • Install Composer
  • Check within Terminal:
    • docker -v
      • Should return something similar to: Docker version 1.12.3, build 6b644ec
    • docker-compose –v
      • Should return something similar to: docker-compose version 1.8.1, build 878cff1
    • composer –V
      • Should return something similar to: Composer version 1.2.1 2016-09-12 11:27:19

If this steps work properly, you can start with one of the two Hands-On Sessions. Just download the corresponding information sheet and work through it.

Hands-On Sessions for Docker:

  1. Development environment for WordPress – Infosheet
  2. Development environment for Laravel – Infosheet

This Hands-On Sessions were only tested on MacOSX!

The comments are closed.