GithubHelp home page GithubHelp logo

entelecheia / dev-containers Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 96 KB

Development containers, or dev containers, are Docker containers that are specifically configured to provide a fully featured development environment.

License: MIT License

Shell 64.50% Makefile 35.50%
devcontainers docker

dev-containers's Introduction

Development Containers

version-image release-date-image license-image

Development containers, or dev containers, are Docker containers that are specifically configured to provide a fully featured development environment.

Development containers seek to find ways to develop, build, test, and deploy software in a containerized environment without the need to install any software on your local machine.

Prerequisites

  • Docker
  • Docker Compose
  • NVIDIA Docker (for GPU support, Optional)

Build and Run

  1. Build the Docker image:

    make docker-build

    The docker.ubuntu-20.04.env file includes various configuration options and environment variables. The docker-compose.ubuntu-20.04.yaml file uses these variables to customize the behavior of the services. This is a common practice when you want to set different configurations for development, testing, and production environments. The Dockerfile.ubuntu-20.04 file uses these variables to customize the Docker build. These files are automatically generated by Copier when you run the copier copy command.

  2. Start the Docker container:

    make docker-up

    This will start a Docker container with the image built in the previous step. The container will run a bash lauch script that starts the application.

Usage

After starting the container, you can access the application at localhost:<CONTAINER_HOST_WEB_SVC_PORT>. By default, the port is set to 19090.

You can also SSH into the container using the SSH port specified in APP_HOST_SSH_PORT. By default, the port is set to 2929.

Volumes

The docker-compose.ubuntu-20.04.yaml file specifies several volumes that bind mount directories on the host to directories in the container. These include the cache, the workspace directory, and the scripts directory. Changes made in these directories will persist across container restarts.

Troubleshooting

If you encounter any issues with this setup, please check the following:

  • Make sure Docker and Docker Compose are installed correctly.
  • Make sure NVIDIA Docker is installed if you're planning to use GPU acceleration.
  • Ensure the environment variables in the docker.ubuntu-20.04.env file are correctly set.
  • Check the Docker and Docker Compose logs for any error messages.

Environment Variables

In Docker, environment variables can be used in the docker-compose.ubuntu-20.04.yaml file to customize the behavior of the services.

The docker-compose command has an --env-file argument, but it's used to set the environment variables for the services defined in the docker-compose.yaml file, not for the docker-compose command itself. The variables defined in the --env-file will not be substituted into the docker-compose.yaml file.

However, the environment variables we set in the .docker/docker.ubuntu-20.04.env file are used in the docker-compose.app.yaml file. For example, the $BUILD_FROM variable is used to set the base image for the Docker build. Therefore, we need to export these variables to the shell environment before running the docker-compose command.

This method also allows us to use shell commands in the variable definitions, like "$(whoami)" for the USERNAME variable, which wouldn't be possible if we used the --env-file argument. Shell commands in the .env file are not evaluated.

Files for Environment Variables

  • .docker/docker.common.env: Common environment variables for all Docker images.
  • .docker/docker.ubuntu-20.04.env: Environment variables for the Docker image.
  • .env.secret: Secret environment variables that are not committed to the repository.

Changelog

See the CHANGELOG for more information.

Contributing

Contributions are welcome! Please see the contributing guidelines for more information.

License

This project is released under the MIT License.

dev-containers's People

Contributors

entelecheia avatar

Stargazers

Nikolaus Schlemm avatar

Watchers

 avatar

dev-containers's Issues

Add CUDA 12.1.0 with Ubuntu 22.04 image variant

Motivation

To provide GPU acceleration support for projects that require CUDA, it would be beneficial to add a new image variant based on the cuda:12.1.0-devel-ubuntu22.04 image. This will allow developers to utilize CUDA 12.1.0 on an Ubuntu 22.04 base image within the development container.

Proposed Changes

  1. Create a new Dockerfile named Dockerfile.cuda-12.1.0-ubuntu22.04 in the .docker directory.
  2. Base the new Dockerfile on the cuda:12.1.0-devel-ubuntu22.04 image.
  3. Adapt the existing Ubuntu 22.04 Dockerfile (Dockerfile.ubuntu-22.04) to work with the CUDA base image.
    • Install necessary dependencies and packages.
    • Set up the non-root user with sudo privileges.
    • Configure the Python environment.
    • Install and set up any additional tools and libraries required for GPU support.
  4. Create a new Docker Compose file named docker-compose.cuda-12.1.0-ubuntu22.04.yaml in the .docker directory.
  5. Define the services and configurations specific to the CUDA 12.1.0 with Ubuntu 22.04 image variant.
  6. Update the Makefile to include new build targets for the CUDA image variant.
    • Add targets for building the image and running the container with GPU support.
  7. Update the README.md file to include instructions on how to use the new CUDA image variant.
    • Provide information on GPU requirements and any additional setup steps.

Benefits

  • Enables GPU acceleration for projects that require CUDA.
  • Provides a consistent development environment for CUDA-based projects.
  • Allows developers to leverage the latest CUDA version (12.1.0) with Ubuntu 22.04.

Possible Drawbacks

  • Increased build time and image size due to the inclusion of CUDA libraries and dependencies.
  • May require additional setup and configuration for GPU passthrough on the host machine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.