Nginx proxy for a Jenkins container

25 May, 2015

As a Mac user, Docker comes in as boot2docker. I don’t quite like using that interface but I prefer having a simple Ubuntu VM on my Vagrant environment where I can manage my containers from a pre-installed Docker. I like this arrangement because it allows me to keep updated on Vagrant, which is more useful for various environments and providers: VirtualBox, VMware, Docker and Hyper-V. I chose Jenkins for this example:


At the end of the line I have a default Jenkins container running and publishing at port 8080. To be able to see it from my Mac browser I need to forward ports from Vagrantfile (8080 to 80) then Nginx (80 to 8080):

http://localhost:8080 >> ubuntu:80 >> jenkins:8080 "forwarded_port", host: 8080, guest: 80, auto_correct: true
  • @ Ubuntu
$ apt-get -y install docker nginx
$ docker rm jenkins1
$ docker run -d -p 8080:8080 --name=jenkins1 jenkins
$ docker inspect jenkins1 | grep IPAddress
  "IPAddress": "",
  • @ Nginx configuration in Ubuntu
$ wget
  (Replace server IP from nginx-reverse-proxy.conf)
$ cp nginx-reverse-proxy.conf /etc/nginx/sites-enabled/jenkins
$ service nginx restart

    Tags: , , , , , , ,

    Leave a Comment