Skip to content

About

A development container that makes it easy to start working on random projects.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

49 Commits

Folders and files

Repository files navigation

Description

This repository contains scripts that makes it easy to start working on random projects without installing a bunch of dependencies on the host computer.

prepare configs

# generate .env
./ctrl.sh genEnv
# generate .env.extra
cp conf_sample.sh conf.sh
./ctrl.sh genEnvExtra

build

docker compose build
# to update base image - to overcome `pull_policy: never`
docker compose build --pull devbox

create network if it doesn't exist yet

bash -c '. .env; docker network ls --format "{{.Name}}" | grep -Fxq "${NETWORK_NAME}" || docker network create "${NETWORK_NAME}"'

start the container

docker compose up -d

SSH

By default password is equal to username. You can change it, or remove it and use ssh key.

a convenient way to copy your host's ssh key to the container

docker compose cp ~/.ssh/authorized_keys devbox:/home/$USER/.ssh/authorized_keys

ssh to the container

./ctrl.sh ssh

other ways to ssh

using network_mode: host

Set this entry in ENV_VARS in conf.sh:

[DEVBOX_CONFIG]=devbox-host

Regenerate .env, rebuild, and connect:

./ctrl.sh genEnv
docker compose up -d --build
./ctrl.sh sshp_h

using hoster

dvddarias/docker-hoster will insert container name in /etc/hosts so you can ssh <containername> which is handy, just run docker ps -a to get container name first.

using dnsdock with dnsmasq

aacebedo/dnsdock provides DNS resolution.

Start the following

docker run --restart=unless-stopped -d -v /var/run/docker.sock:/var/run/docker.sock --name dnsdock -p 127.0.1.53:53:53/udp aacebedo/dnsdock:v1.17.0-amd64 -v --domain=docker

Add the following to /etc/dnsmasq.conf

server=/docker/127.0.1.53

Then you can add to ssh config (example):

Host devbox_test-devbox-1
    Hostname devbox_devbox_test.docker

Then ssh:

ssh devbox_test-devbox-1

ssh to devcontainer on another machine

You can uncomment ports section and ~/.Xauthority section in docker-compose.yml and do the following

ssh -Y -p 2022 $USER@<hostmachine>

About

A development container that makes it easy to start working on random projects.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages