Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: https://github.com/jenkinsci/docker/issues/779#issuecomment-449710461

You should have Docker properly installed on your machine. Check  Docker installation guide for details.

First, pull the official jenkins image from Docker repository.

Code Block

docker pull jenkins

Next, run a container using this image and map data directory from the container to the host; e.g in the example below /var/jenkins_home from the container is mapped to jenkins/ directory from the current path on the host. Jenkins 8080 port is also exposed to the host as 49001.

Code Block

docker run -d -p 49001:8080 -v $PWD/jenkins:/var/jenkins_home:z -t jenkins/jenkins

Addtionally, you can configure nginx as a reverse proxy to your Jenkins instance, e.g.

Code Block

upstream app {
    server 127.0.0.1:49001;
}
server {
    listen 80;
    server_name jenkins.your-domain.com;

    location / {
        proxy_pass http://app;
    }
}