Run your Development Server on Docker Desktop on Windows

Start with the easiest case

Posted by Torsten Kleiber on March 22, 2022
Tags: Docker Docker-Desktop Infrastructure-as-Code Virtual-Development-Server Windows

In my series about Modern Infrastructure for your Virtual Development Server I will now start with the easiest case for me. I will run a Server on a Docker Desktop on Windows. As I need CI for all of my projects I will use Jenkins as example for this. See how this works.

Here you see the architecture overview:

virtual development server docker desktop on windows

At first you need to install Docker Desktop Windows.

Docker Compose is then already installed with Docker Desktop.

Next I create a Docker Compose file for my Jenkins server. To make it easy for this blog I will start only a standard Jenkins server, for this I use the most parameters from Jenkins documentation.

docker-compose.yml
version: '3.8' (1)
services:
  jenkins: (2)
    environment:
      - DOCKER_CERT_PATH=/certs/client
      - DOCKER_HOST=tcp://docker:2376
      - DOCKER_TLS_VERIFY=1
    image: jenkins/jenkins:lts-jdk11 (3)
    ports:
      - "8080:8080"
      - "50000:50000"
    restart: unless-stopped (4)
    volumes:
      - jenkins_data:/var/jenkins_home
      - jenkins_docker_certs:/certs/client:ro
volumes:
  jenkins_data:
  jenkins_docker_certs:
1 Compose file format should match to the Compatibility matrix.
2 Jenkins is the single service for our example.
3 I use the long term support Jenkins image with JDK 11 runtime.
4 The service should be started with Docker Desktop and in case of an error.

To give your Development Server component a unique name you can set the project name environment variable via the .env file.

.env
COMPOSE_PROJECT_NAME=project

From the directory of your files you can now use following commands to control your Development Server:

docker compose up --detach
docker compose stop
docker compose down

If you start your server you should see the following in the Docker Desktop Console:

virtual development server docker desktop on windows docker desktop

As your server is running you can now access it via localhost:8080:

virtual development server docker desktop on windows unlock jenkins

You can go now to Docker Desktop,

virtual development server docker desktop on windows jenkins password
1 open the container console
2 and get the password to further configure Jenkins from the browser.

In a later blog I will show you a ready configured Jenkins server via Infrastructure as Code.

You find all sources on GitHub.

That’s it!