I am trying to run GoCD server in Docker in a VM. To test the setup I created an Ubuntu 14.04 server in VirtualBox, installed Docker, and then following instructions from
https://github.com/gocd/gocd-docker & https://hub.docker.com/r/gocd/gocd-server/ I ran:
docker run -tiP gocd/gocd-server
This works, but the problem is that if I close the terminal (which I'll have to do in production because I cannot keep an SSH terminal open indefinitely) the server dies. I was able to get the port this server was running on by opening another terminal to the VM and running docker PS. I was able to access that one from my browser. Of course I need a solution that allows me to close the terminal.
So I tried it again (in a fresh VM), hit Ctrl+C, waited for it to shut down, then ran:
docker rename randomDockerName gocd-server
and then
docker start gocd-server
docker ps
I then see something like
randomLetters gocd/gocd-server "/sbin/my_init" 25 minutes ago Up 10 minutes 0.0.0.0:32773->8153/tcp, 0.0.0.0:32772->8154/tcp gocd-server
So I point my chrome on my Ubuntu 14.04 host machine to ipaddress:32773 and I get nothing. Now when the docker image was running with docker run this worked just fine, so why isn't this working with docker start? I can't use run again because that creates a new docker image and I have to keep the terminal open to keep the server running.
So my question is, how do I run GoCD in Docker on a VM without having to stay logged in to that VM?
Also, the Ubuntu VM is configured in VirtualBox with both a NAT and a Bridged network card.