Skip to content

Commit

Permalink
improved lock file documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
wholtz committed Jun 23, 2022
1 parent 4db2399 commit 41d5bd8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ using [conda-lock](https://github.com/conda-incubator/conda-lock) or
micromamba:

```bash
docker run -it --rm -v $(pwd):/mnt mambaorg/micromamba:0.24.0 \
/bin/bash -c "micromamba install -y -f /mnt/env.yaml && \
micromamba env export --explicit > /mnt/env.lock"
docker run -it --rm -v $(pwd):/tmp mambaorg/micromamba:0.24.0 \
/bin/bash -c "micromamba create --yes --name new_env --file env.yaml && \
micromamba env export --name new_env --explicit > env.lock"
```

The lockfile can then be used to create a conda environment:
The lockfile can then be used to install into the pre-existing `base` conda environment:

```Dockerfile
FROM mambaorg/micromamba:0.24.0
Expand All @@ -174,6 +174,15 @@ RUN micromamba install --name base --yes --file /tmp/env.lock && \
micromamba clean --all --yes
```

Or the lockfile can be used to create and populate a new conda environment:

```Dockerfile
FROM mambaorg/micromamba:0.24.0
COPY --chown=$MAMBA_USER:$MAMBA_USER env.lock /tmp/env.lock
RUN micromamba create --name my_env_name --yes --file /tmp/env.lock && \
micromamba clean --all --yes
```

When a lockfile is used to create an environment, the `micromamba create ..`
command does not query the package channels or execute the solver. Therefore
using a lockfile has the added benefit of reducing the time to create a conda
Expand Down

0 comments on commit 41d5bd8

Please sign in to comment.