Simple non-root user Miniconda environment, with support for multiple architectures.
- Installs the latest version of Miniconda.
- Sets up a non-root user (default:
app
) withsudo
privileges (for debug purposes). - The
base
Conda environment is automatically activated upon login. - Supports
linux/amd64
andlinux/arm64
architectures. - Includes
git
,curl
,sudo
, andgosu
.
To build the multi-platform Docker image, you can use:
docker buildx build \
--platform linux/amd64 \
-t c127/miniconda:latest \
.
This script uses docker buildx
and will tag the image as c127/miniconda:latest
.
You can run the container using the following command:
docker run -it --rm \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-e APP_USER=myuser \
-e APP_PASS=mypassword \
-v $HOME:/app \
c127/miniconda:latest
This will start an interactive bash
session within the container, with the Miniconda base
environment activated for the specified user.
The following environment variables can be configured when running the container:
PUID
: Process User ID for the in-container user. Defaults to1000
.PGID
: Process Group ID for the in-container user. Defaults to1000
.APP_USER
: The username for the in-container user. Defaults toapp
(as set in the Dockerfile).APP_PASS
: The password for theAPP_USER
. Warning: The default password (RT2fEDayXh4zVQBtr7WwCHgd
) set in the Dockerfile is for debugging purposes only. Please override this with a secure password for any production or sensitive use.
Use volumes to persist data on host computer and keep fast your environment (Recommended)
Main Volume
: For conda environments & packages and home for user data/app
.
Once the container is running, you will be logged in as the user defined by APP_USER
. The Miniconda base
environment is automatically sourced via the source/app-start script, which is called by the source/entrypoint script.
You can immediately start using conda
commands:
conda info
conda install numpy
conda create -n workspace python=3.9
conda activate workspace
The user also has sudo
privileges, using the password provided via the APP_PASS
environment variable.
The Dockerfile performs these key steps:
- Uses
debian:bullseye-slim
as the base image. - Sets essential environment variables, including
CONDA_INSTALL_PATH
,APP_USER
, andAPP_PASS
. - Installs necessary packages like
curl
,bash
,sudo
,git
, andgosu
. - Copies the source/entrypoint and source/app-start scripts into the image.
- Sets
/usr/local/bin/entrypoint
as theENTRYPOINT
.
The source/entrypoint script handles:
- Creation of the user and group based on
PUID
,PGID
, andAPP_USER
. - Installation of Miniconda for the appropriate architecture (
TARGETARCH
). - Initialization of
conda
for thebash
shell. - Setting the user's password and granting
sudo
access. - Execution of the source/app-start script.
The source/app-start script:
- Activates the
base
Conda environment. - Starts an interactive
bash
shell.
This project is licensed under the MIT License. See the LICENSE file for details.