What is Docker?

Docker is a tool designed to make it easier to create, deploy, and runapplications by using containers. Containers allow a developer to packageup an application with all of the parts it needs, such as libraries and otherdependencies, and ship it all out as one package. By doing so, thanks to thecontainer, the developer can rest assured that the application will runon any other Linux machine regardless of any customized settings thatmachine might have that could differ from the machine used for writingand testing the code.

In a way, Docker is a bit like a virtual machine. But unlike a virtualmachine, rather than creating a whole virtual operating system, Dockerallows applications to use the same Linux kernel as the system thatthey’re running on and only requires applications be shipped with thingsnot already running on the host computer. This gives a significantperformance boost and reduces the size of the application.

Cited from opensource.com.

What is Docker? is licensed under aCreative Commons Attribution-ShareAlike 4.0 International License

Refer to CC-BY-SA-4.0for more information.

What is a Docker Image and how is it different from a container?

An image is an immutable file which contains required binaries and librariesneeded to make a container and a running instance of an image is calleda container. Images are composed of layers of other images. Images arecreated when we run the build command of Docker and containers are formedfrom these images when we use the run command of Docker. There can bemany containers for the same image.

For more information about Docker see theofficial documentation.

Installing Docker

Docker installation guide for various operating systems can be found in theofficial Docker installation instructions.

Note

Docker images are usually very large. Downloading or pushing them overlow bandwidth connections can be very slow.

coala as a Docker Image

We provide a coala/base docker image for your convenience, that hasdependencies for most official bears already installed.

You can use the coala/base docker image to perform static code analysison your code in the working directory, like this:

  1. docker run -v=$(pwd):/app --workdir=/app coala/base coala --ci

See also

See also https://hub.docker.com/r/coala/base/.

Note

The coala Docker image does not support Python 2 analysis.

You can add coala as alias for docker image, like this:

  1. alias coala="docker run -ti -v $(pwd):/app --workdir=/app coala/base coala"

coala on GitLab CI

You can use the coala/base docker image to perform static code analysison your code with a .gitlab-ci.yml, like this:

  1. check_code:
  2. image: coala/base
  3. script:
  4. - pip install -r requirements.txt
  5. - coala --ci

Note

For more information about GitLab CI configuration, consult theofficial documentation.

Troubleshooting GitLab CI

You might experience DNS related difficulties with a private GitLab CI setup.The coala container might not be able to clone the repository if the GitLabserver name is not resolvable.

When this is the case, the most straightforward workaround is to add aconfiguration line inside the config.tomlconfiguration filefor the gitlab-ci-multi-runner runner:

  1. extra_hosts = ["my-gitlab.example.com:192.168.0.100"]

Please be aware that the most generic dns setting listed in thegitlab-ci-multi-runner documentation has been recently added and atthe time of this writing is not available in official builds.

coala on Travis CI

You can use the coala/base docker image to perform static code analysison your code with a .travis.yml, like this:

  1. language: generic
  2. services: docker
  3. script: docker run -v=$(pwd):/app --workdir=/app coala/base coala --ci

Note

For more information about Travis CI configuration, consult theofficial documentation.

coala on Circle CI

You can use the coala/base docker image to perform static code analysison your code with a circle.yml, like this:

  1. machine:
  2. services:
  3. - docker
  4.  
  5. test:
  6. override:
  7. - docker run -v=$(pwd):/app --workdir=/app coala/base coala --ci

Note

For more information about Circle CI configuration, consult theofficial documentation.