Skip to content

A simple Dockerfile for an Ubuntu development environment. Portable for use with classes and projects. Also useful as an experimental sandbox.

Notifications You must be signed in to change notification settings

s7117/docker-envs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Docker Environments

A simple Dockerfile for an Ubuntu 22.04 development environment. Portable for use with classes, projects, development, research, and more. It is also useful as an experimental sandbox and packaging your work for reproducible work for dissemination.

As of now these environments are only on Ubuntu but in theory should be able to be ported to other distros by changing the FROM at the beginning of the Dockerfile. Keep in mind you may need to change the package manager and other distro-specific commands in the Dockerfile.

Basic Usage:

While the basic use command will work, looking at the readme.md file in each respective directory will yield better results and more granular functionality.

docker run --name <container-name> -ti s7117/ubuntu-<suffix>:<tag>

Continued Usage:

WARNING: Do NOT use the docker start command to launch additional shells. See Launching a second shell for this information.

Starting a stopped container:

To continue to use a container that was created by using the docker run command above use the following once:

docker start -ai <container-name>

NOTE: If you did not name your container use docker container ls -a to determine the Docker randomly assigned name/id.

Launching a second shell:

Use the following command on a running Docker container to launch a new shell in the container (you can replace /bin/bash with another command if you would like to run another shell/command):

docker exec -ti <container-name> /bin/bash

Stopping a container:

Use the following command to stop/terminate a running container:

docker stop <container-name>

Detailed Usage:

See the README.md in each respective directory for specific usage instructions and details.

See docs/common-docker.md for some common docker commands and their definitions.

Environments

  • ubuntu-base - Customized Ubuntu Development Environment
  • ubuntu-cuda - Customized CUDA Image
  • ubuntu-cuda-ml - Machine Learning Image with PyTorch (torchgpu) and TensorFlow GPU (tfgpu) installed under Miniforge3
  • ubuntu-ml - Machine Learning Image with PyTorch (torchgpu) and TensorFlow CPU (tfgpu) installed under Miniforge3

Confirming Device Passthrough

Use lsusb and lspci to confirm that the devices desired to be accessible in the Docker container appear.

GPU Passthrough

Check that TensorFlow/PyTorch can see the GPU:

>>> # TensorFlow
>>> import tensorflow as tf
>>> tf.config.list_physical_devices('GPU')
>>> tf.sysconfig.get_build_info()['cuda_version']
>>> # PyTorch
>>> import torch
>>> torch.cuda.is_available()
>>> torch.version.cuda

Docker Aliases

If you want some easy and quick shortcuts for using Docker consider taking a look at my .dotfiles GitHub repository!

Some simple examples:

  • dils: list all Docker images
  • dcls: list all Docker containers
  • drmi: delete a Docker image
  • drmc: delete a Docker container
  • dclean: delete all Docker containers and images and prune caches.

About

A simple Dockerfile for an Ubuntu development environment. Portable for use with classes and projects. Also useful as an experimental sandbox.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published