Efficient Development Environment Setup Using Docker
This article explains how the author leverages Docker containers to build a reproducible, low‑overhead development environment, compares traditional script‑based setups, demonstrates an Nginx example with Dockerfile and supporting scripts, introduces the dockerbox utility for easier container interaction, and shows how to configure automatic startup on new machines.
Docker, as a lightweight container solution with low system intrusion and high portability, is ideal for complex service deployment and development environment construction; the author shares how their company uses Docker to efficiently set up development environments.
The author, a developer who enjoys experimenting with various open‑source tools and adheres to the principle of minimal privileges, has worked with many stacks (CentOS, Apache/Nginx, PHP, Go, MySQL/MariaDB, Redis, Kafka/NSQ) and prefers to build these services themselves rather than relying on dedicated ops staff.
Traditional approach : Scripts were written for each software’s compilation and installation, but they broke across different OS versions, upgrades, and library mismatches, leading to duplicated effort and maintenance headaches.
Docker approach :
Run each software inside a fixed container, allowing a single build script per service.
Mount source code into containers via data volumes.
Use --net=host for simple networking in development.
Store image creation and container startup scripts in a Git project, abstracting a unified build process for easy onboarding of new software and machines.
An example Nginx environment is provided, with the project hosted at https://gitee.com/andals/docker-nginx . The repository’s README outlines the required scripts and project structure.
The Dockerfile is described and the build framework includes:
Copy required packages into the image.
Copy build scripts into the image.
Execute the build scripts.
Run init.sh on container start to launch services.
The README also lists the commands to build the image and run the container.
Auxiliary tool: dockerbox – to simplify interaction with containers, avoiding the multi‑step process of locating a container, entering it, and executing commands. Dockerbox provides convenient shortcuts for tasks such as reloading Nginx or inspecting service status. Its source and usage are at https://github.com/ligang1109/dockerbox .
Configuring auto‑start – the author explains how to set up the development environment to start automatically on boot, especially when using a virtual machine, and references dockerbox for the startup procedure.
In conclusion, the author invites readers who enjoy tinkering to try this Docker‑based setup and share any better methods.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
360 Tech Engineering
Official tech channel of 360, building the most professional technology aggregation platform for the brand.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
