Build a docker container as your workspace.
MIT License
Build a docker container as your workspace.
~/.ssh
and ~/.gitconfig
1. Install dockerlab
Install dockerlab with pip:
pip install dockerlab
Or install the latest version from source:
pip install git+https://github.com/hughplay/dockerlab.git
2. Setup a dockerlab project
Create a new dockerlab project:
dockerlab new <project_name>
Or init a dockerlab environment for the existing project:
dockerlab init .
This will setup a few files and directories, the structure is as follows:
.
├── docker/
│ ├── Dockerfile
│ └── misc/
├── docker-compose.yml
├── docker.py
├── Makefile
└── .gitignore
3. DIY your own workspace environment
In general, you only need to modify docker/Dockerfile
to customize your own workspace environment. Files you may care about:
docker/Dockerfile
: The dockerfile for building the docker image.docker-compose.yml
: The docker-compose file for building the docker container.docker.py
: The python script for building and starting the container.Makefile
: Convenient commands based on make.We have prepared several templates and pre-built docker images for you. You can replace the default docker/Dockerfile
with the template you like by running the following command:
dockerlab use <template_name>
The available templates can be listed by dockerlab ls
, and the details of each template can be found in dockerlab/templates.
By default, the generated docker/Dockerfile
will use pre-built docker images if there exists. You can also get the full dockerfile by running the following command:
dockerlab use <template_name> --full
4. Build and start the container
make init
When you first execute the above command, it will ask you to enter information related to the container and store them in .env
. The example of prompt and the output are as follows:
# prompts
Give a project name [dockerlab]: dockerlab
Code root to be mounted at /project [.]:
Data root to be mounted at /data [data]:
`/home/hongxin/code/dockerlab/data` does not exist in your machine. Create? [yes]:
Log root to be mounted at /log [log]:
`/home/hongxin/code/dockerlab/log` does not exist in your machine. Create? [yes]:
directory to be mounted to hongxin [./docker/misc/container_home]:
`/home/hongxin/code/dockerlab/container_home` does not exist in your machine. Create? [yes]:
# output
Your setting (.env):
UID: 1000
GID: 1000
USER_NAME: hongxin
PROJECT: dockerlab
CODE_ROOT: .
DATA_ROOT: /home/hongxin/code/dockerlab/data
LOG_ROOT: /home/hongxin/code/dockerlab/log
CONTAINER_HOME: /home/hongxin/code/dockerlab/container_home
COMPOSE_PROJECT_NAME: dockerlab_hongxin
5. Get in the container and start your journey.
make in
DockerLab is released under the MIT license.