Skip to content

Fix no-user-in-docker-container-when-using---build-template-condapixiv1 #974

Merged
munishchouhan merged 5 commits intomasterfrom
973-no-user-in-docker-container-when-using---build-template-condapixiv1
Mar 4, 2026
Merged

Fix no-user-in-docker-container-when-using---build-template-condapixiv1 #974
munishchouhan merged 5 commits intomasterfrom
973-no-user-in-docker-container-when-using---build-template-condapixiv1

Conversation

@munishchouhan
Copy link
Copy Markdown
Member

closes #973

Problem

Python's getpass.getuser() was raising OSError: No username set in the environment when running in containers built with the pixi template, but worked fine with the
micromamba template.

Root Cause

The pixi template didn't set the USER environment variable in the final container stage, while Python's getpass.getuser() function requires one of these environment
variables to be present: LOGNAME, USER, LNAME, or USERNAME.

Solution

Updated the pixi Dockerfile template (src/main/resources/templates/conda-pixi-v1/dockerfile-conda-file.txt) to match the micromamba v2 template behavior by adding:

  • USER root directive
  • ENV USER=root environment variable

This ensures Python applications can successfully call getpass.getuser() without errors.

Changes

  • Modified conda-pixi-v1/dockerfile-conda-file.txt to add USER and ENV directives
  • Updated all pixi-related tests in TemplateUtilsTest and ContainerHelperTest to reflect the new template output

Signed-off-by: munishchouhan <hrma017@gmail.com>
@munishchouhan munishchouhan self-assigned this Jan 28, 2026
@munishchouhan munishchouhan marked this pull request as draft January 28, 2026 13:23
@munishchouhan
Copy link
Copy Markdown
Member Author

tested locally with the reprocuder:
#973 (comment)

container: docker.io/hrma017/python_pip_drevalpy:5a2ddde782d035e0

% nextflow run test_container.nf -c docker-user.config

 N E X T F L O W   ~  version 25.11.1-edge

Launching `test_container.nf` [desperate_lamport] DSL2 - revision: cc774c8f10

executor >  local (1)
[31/87ea03] TEST_PYTHON_CONTAINER [100%] 1 of 1 ✔
Completed at: 10-Feb-2026 10:08:11
Duration    : 7m 4s
CPU hours   : 0.1
Succeeded   : 1

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@munishchouhan munishchouhan merged commit c2042fa into master Mar 4, 2026
4 checks passed
@munishchouhan munishchouhan deleted the 973-no-user-in-docker-container-when-using---build-template-condapixiv1 branch March 4, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No user in docker container when using --build-template conda/pixi:v1

3 participants