I’m a big fan of CLI scripting, coding, and configuring, I’ve recently dived into setting up my first GitHub page to showcase my projects and share my experiences. I’m definitely not a pro at any of the technical skills named above but the mission is to lab up, create projects, and start getting hands-on experience to learn and grow my skills.
Goals
The goal here was to create a Docker container with all the dev tools I wanted for a basic infrastructure/DevOps environment for me to use as my learning playground. This setup allows me to clone repositories, write IaC configurations, run Ansible playbooks, deploy infrastructure with Terraform, interact with Azure through the CLI, and manage Kubernetes clusters with Kubectl—all from a single, portable environment that I self host. Now when I say portable this is because in my case I use a VPN to connect back to my home lab server where this vscode server container and repositories live and the environment is also browser-based.
You’ll find the repository I made for this project here here if you’d like to follow along and use my repository to build the code server easily or use this guide for insparation to set up your own environment from scratch too.
Tools Included:
- VS Code (code-server)
- Git
- Ansible
- Terraform
- Azure CLI
- Kubectl
- Docker CLI
- Various networking tools
Pre-requisites
- Machine with Linux OS (Sever, VM, Computer)
- Basic understanding of Docker and Docker Compose
- Docker and Docker Compose installed
- (Optional) VPN Server or Reverse Proxy for remote access
Setting Up
1. Setting Up the Workspace
First, create a new directory for the project:
mkdir dev_env_container
cd dev_env_container
Inside this directory, we’ll need two key files: `Dockerfile` and `docker-compose.yml`. Use the following commands to create these files:
touch Dockerfile
touch docker-compose.yml
2. Understanding the Dockerfile
The `Dockerfile` is really the blueprint for the container image so it’s important to know the basics. Here’s a brief high-level overview of what’s inside my Dockerfile in my dev_env repository:
- Base Image – Starts with Ubuntu 20.04 for stability and support.
- Essential Tools I Wanted – Installation of native tools like `curl`, `git`, `python3`, etc.
- Networking Tools – like ping and net-tools for basic network troubleshooting.
- Installation Scripts – Using `curl` to fetch and install nonnative tools like Ansible, Terraform, Azure CLI, and kubectl.
- VS Code – Obviously the meat of the project so a curl to install code-server to enable VS Code in the browser.
Here’s a snippet from the Dockerfile:
# Use Ubuntu 20.04 as the base image.
FROM ubuntu:20.04
# Set environment variable to prevent prompts during package installation.
ENV DEBIAN_FRONTEND=non-interactive
# Update the package list and install utilities, Git, Ansible, Python3, and pip3.
RUN apt-get update && apt-get install -y \
curl \
git \
unzip \
ansible \
python3 \
python3-pip
# Install networking tools
RUN apt-get update && apt-get install -y iputils-ping netcat traceroute net-tools
3. Docker Compose Config
The `docker-compose.yml` file specifies how Docker should run the environment. Key parts to know here are:
- Volumes – directories or files to mount from the host
- Ports – Maps ports between the container and host machine.
- Environment Variables – In this case it sets a password for code-server authentication.
Here’s a snippet from the docker-compose.yml:
dev_env:
build:
context: .
dockerfile: Dockerfile
image: dev_env:latest
volumes:
- /yourvolumehere/Code:/code
ports:
- "1123:8080"
environment:
- PASSWORD=YourPasswordHere
4. Building the Container Image
With the to files completed to build the container that you made or by just copying and pasting my repository, navigate to the directory where `Dockerfile` and `docker-compose.yml` are stored and run:
docker-compose build
This command builds the container image by processing the Dockerfile specified in the docker compose file.
5. Run the Container
To start the container, use the command:
docker-compose up
You can verify the container is up with:
docker-compose ps
Once the container is up, you should be able to access code-server at `http://<yourhostIP>:1123` and log in with the authentication password you set in the docker compose file.


And that’s it. You now have a versatile dev environment that you can use anywhere. Hope you find that as cool as I do and happy coding!