View Source

h6. Install and configure Docker

Install docker according to [docs|https://docs.docker.com/installation/ubuntulinux/]:
{code}
wget -qO- https://get.docker.com/ | sh
{code}


h6. Steps

Use a _data volume container_ for persistence.

{code}
sudo mkdir /data
sudo docker create -v /data/nexus_home --name nexus-data sonatype/nexus
sudo docker pull sonatype/nexus
--sudo docker run -d --name nexus-data sonatype/nexus echo "data-only container for Nexus"--
sudo docker run -d -p 8081:8081 --name nexus20150527 --volumes-from nexus-data --restart=on-failure:10 sonatype/nexus
{code}

* *TODO* Evaluate how to restart nexus at boot.
** [https://docs.docker.com/articles/host_integration/]


* Follow the [Post-Install Checklist|http://books.sonatype.com/nexus-book/reference/install-sect-repoman-post-install.html]

h6. Explore

Check that you now have two containers. nexus-data container do not have to be running.
{code}
sudo docker ps -a
{code}


{code}
curl http://localhost:8081/service/local/status
{code}

http://stackoverflow.com/questions/23405689/accessing-a-docker-containers-file-system-through-terminal

{code}
sudo docker exec -t -i nexus /bin/bash
{code}

h6. Read more
* https://registry.hub.docker.com/u/sonatype/nexus/
* [Persistent volumes with Docker - Data-only container pattern|http://www.tech-d.net/2013/12/16/persistent-volumes-with-docker-container-as-volume-pattern/]


h4. Apache reverse proxy

{code}
sudo a2enmod headers
{code}

{code}
<VirtualHost *:80>
ServerName someIpHere
Redirect / https://someIpHere/
</VirtualHost>

<VirtualHost *:443>
ServerName someIpHere
RequestHeader set X-Forwarded-Proto "https"

SSLEngine On
SSLCertificateFile /etc/apache2/ssl/some.no.crt
SSLCertificateKeyFile /etc/apache2/ssl/some.no.key


ProxyPass /jenkins http://localhost:8080/jenkins nocanon
ProxyPassReverse /jenkins http://localhost:8080/jenkins
ProxyRequests Off
AllowEncodedSlashes NoDecode
#Doc: https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache

#books.sonatype.com/nexus-book/reference/install-sect-proxy.html
ProxyPass /nexus/ http://localhost:8081/
ProxyPassReverse /nexus/ http://localhost:8081/
ProxyPassReverseCookiePath / /nexus
</VirtualHost>
{code}