Sumit Gupta
Sumit Gupta

Reputation: 2192

Docker in Development Environment

I am looking to set my development machine (one physical machine) to provide me a way to manage my need of running .NET and PHP development. This is fairly easy, but problem arise when I need Apache along with IIS, and for version control I love gitlab ce which doesn't work on windows. So, my main machine is win10, and I use a separate linux box to run my gitlab and apache.

But now that machine is burned up and I am looking a way to run all that in one machine as I don't want to invest in separate machine. I am trying to study Docker as it seems solution to my problem (nor really sure). So, I install Docker with Hyper-Von my Win 10, and was able to run CentOS in docker container and install Apache and GitLab over that CentOs

But as soon as exit the centos all is gone. I understand that I need to save the machine state or docker client's state but I didn't find a way to do it or they are fairly complex to understand for me. I Also didn't find a way that when I boot up my development machine how can I make it to start that CentOS machine and that it become available on network. I am searching in docker document and various blog forum.

My question here is: As I do not understand docker quite well right now, is my thinking to use it above scenario good? Is there any better method that this? If you can assist in my problem is good for me, but if not just guide me if I am going right way.

Oh I am not concern on hardware as my machine does support my requirement for now.

Upvotes: 1

Views: 229

Answers (1)

VonC
VonC

Reputation: 1323115

You can see an example of running GitLab in a docker container in "Run GitLab on a USB Stick with Docker"

It uses an USB stick but you could use a folder on your (Windows) host.

The docker-compose.yml is

gitlab:  
 container_name: gitlab
 image: gitlab/gitlab-ce:8.5.3-ce.0
 hostname: gitlab
 environment:
   GITLAB_OMNIBUS_CONFIG: |
     external_url 'http://127.0.0.1:8050'
     gitlab_rails['gitlab_shell_ssh_port'] = 522
 ports:
  - "8050:8050"
  - "522:22"
 volumes:
  - /media/elton/usb-gitlab/gitlab/config:/etc/gitlab
  - /media/elton/usb-gitlab/gitlab/logs:/var/log/gitlab
  - /media/elton/usb-gitlab/gitlab/data:/var/opt/gitlab
 privileged: true

You might not need privileged: true as you don't need to access the USB key.
And replace /media/elton/usb-gitlab/gitlab by a Windows path (starting with /c/Users as /c/Users/yourLogin/path/to/gitlab, as only that folder is auto-mounted in the boot2docker VM)

Then:

cd /c/Users/yourLogin/path/to/gitlab  
docker-compose up -d  

In your repo, you would add:

git remote add origin ssh://[email protected]:522/<project>/<yourRepo>.git  

And you would go to http://127.0.0.1:8050/ in order to see the GitLab web interface.

Upvotes: 1

Related Questions