A comprehensive Docker-based development environment with SSH access, code-server IDE, Docker-in-Docker capabilities, and remote tunnel support via Cloudflare.
Build the image:
docker build -t dev-environment .
Run the container:
docker run -d \
--name dev-env \
--privileged \
-p 2222:22 \
-p 8080:8080 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/workspace:/home/user/workspace \
dev-environment
Access your environment:
ssh -p 2222 user@localhost (password: password)http://localhost:8080 in your browserlazydocker inside the containerCreate a docker-compose.yml file:
services:
docker-environment:
image: h4shelldocker/docker-environment:latest
privileged: true
entrypoint: /usr/bin/entrypoint.sh
container_name: docker-environment
hostname: "docker-environment"
restart: always
ports:
- "2222:22"
- "2223:20223"
volumes:
- "home:/home"
- "run:/var/run/"
environment:
- ENV_USER=user
- ENV_PASS=password
- GIT_NAME=Lorenzo Fornara
- [email protected]
volumes:
home:
driver: local
run:
driver: local
Run with:
docker-compose up -d
services:
docker-environment:
image: h4shelldocker/docker-environment:latest
privileged: true
entrypoint: /usr/bin/entrypoint.sh
container_name: docker-environment
hostname: "docker-environment"
restart: always
ports:
- "2222:22"
- "2223:20223"
volumes:
- "home:/home"
- "run:/var/run/"
environment:
- ENV_USER=user
- ENV_PASS=password
- GIT_NAME=Lorenzo Fornara
- [email protected]
# wetty-env:
# image: wettyoss/wetty
# container_name: wetty-env
# restart: always
# ports:
# - "2220:20200"
# entrypoint: node /usr/src/app/build/main.js -p 20200 --ssh-host docker-environment --ssh-user user
# environment:
# - SSH_HOST=docker-environment
# - SSH_PORT=22
# - BASE=/
cloudflare-env:
image: cloudflare/cloudflared:latest
restart: always
container_name: cloudflare-env
command: tunnel --url docker-environment:20223
volumes:
home:
driver: local
run:
driver: local
You can customize the environment during build:
docker build \
--build-arg ENV_USER=myuser \
--build-arg ENV_PASS=mypassword \
--build-arg GIT_NAME="Your Name" \
--build-arg GIT_EMAIL="[email protected]" \
-t docker-environment .
Available build arguments:
ENV_USER: Username for the development user (default: user)ENV_PASS: Password for the development user (default: password)DIR: Installation directory for binaries (default: /usr/bin)GIT_NAME: Git username (default: h4shell)GIT_EMAIL: Git email (default: [email protected])The container generates SSH keys automatically. To use key-based authentication:
Copy the private key from the container:
docker cp dev-env:/home/user/.ssh/id_rsa_env ~/.ssh/dev-env-key
chmod 600 ~/.ssh/dev-env-key
Connect using the key:
ssh -i ~/.ssh/dev-env-key -p 2222 user@localhost
The container expects these files in your build context:
.
├── Dockerfile
├── .bashrc # Custom bash configuration
├── tunnel # Cloudflare tunnel configuration script
└── entrypoint.sh # Container startup script
⚠️ Important Security Considerations:
user:password - change them in productionIf Docker commands fail inside the container:
# Check Docker daemon status
docker exec -it dev-env service docker status
# Restart Docker daemon
docker exec -it dev-env service docker restart
# Check SSH service status
docker exec -it dev-env service ssh status
# View SSH logs
docker exec -it dev-env tail -f /var/log/auth.log
Start the environment:
docker-compose up -d
Access via SSH for terminal work:
ssh -p 2222 user@localhost
Use code-server for IDE features:
http://localhost:2223Manage Docker containers:
# Inside the container
lazydocker
# or
docker ps
Feel free to submit issues and pull requests to improve this development environment.
This project is open source. Please check the license file for details.
Content type
Image
Digest
sha256:3c42b066d…
Size
785.1 MB
Last updated
4 months ago
docker pull h4shelldocker/docker-environment