Skip to content

Dockerized servers, databases, web servers, etc. managed with Docker Compose

Notifications You must be signed in to change notification settings

misho-kr/docker-fast-containers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Useful Docker Containers

Dockerized servers, databases, web servers, etc. that are quick to launch with a single command.

Better to pull a Docker image and start a container, instead of installing one or more software packages that will clutter your machine and will run as regular (unrestricted) processes.

  • Jenkins
  • MongoDB
  • MySQL
  • Nginx
  • Redis
  • Tomcat
  • Zabbix

Usage

All Docker containers are started with docker-compose. As a consequence the command to bring up any container is boringly repetitious:

$ docker-compose -f containers/mongo.yml up
Creating containers_mongo_1...
Pulling image mongo:2.6...
2.6: Pulling from library/mongo
ba249489d0b6: Pull complete
...
mongo26_1 | 2015-09-18T03:18:32.354+0000 [initandlisten] waiting for connections on port 27017

SELinux requirement

Most containers will mount the data directory to externalize and preserve the state (any data and log files) after shutdown. On systems with SELinux in enforcing mode the bind-mount will fail unless this command has been executed in advance:

$ chcon -Rt svirt_sandbox_file_t data

Jenkins as non-root user

The Jenkins process inside the Docker container can be run as either root or jenkins user. From security perspective it is better to choose the latter, however that presents a challenge due to the bind-mounted Jenkins workspace directory.

The solution is to set up the Jenkins workspace directory on the Docker host in advance before it is attached to the container:

$ mkdir data/jenkins.dir
$ sudo chown $(docker run --rm jenkins echo $(id -u):$(id -g)) data/jenkins.dir 
$ docker-compose -f containers/jenkins.yml up jenkins

If you don't want to play this trick then just start the container with the Jenkins process as root user:

$ docker-compose -f containers/jenkins.yml up jenkins-root

Jenkins with Docker-in-Docker

For use cases where Jenkins has to build Docker images, this is a classic example of running Docker inside Docker container. It is doable, with some strings attached -- for details reaad Jerome's blog and follow the link to his GitHub repo.

What is provided here is two seperate images:

  • Jenkins with Docker version 1.8
  • Jenkins with Docker version 1.9

Note that both containers will run Jenkins as root. So if you are running on you machine Docker v1.9 (latest and greatest atm) then pick the latter one:

$ docker-compose -f containers/jenkins.yml up jenkins-dind-1_9

About

Dockerized servers, databases, web servers, etc. managed with Docker Compose

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published