8000 feat: Add rootless Docker support by Fank · Pull Request #574 · factoriotools/factorio-docker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Add rootless Docker support #574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Fank
Copy link
Member
@Fank Fank commented Jul 3, 2025

Summary

This PR implements rootless Docker support as requested in #547, providing a cleaner solution for users experiencing permission issues with Docker volumes.

What's Changed

New Rootless Images

  • Added Dockerfile.rootless that runs as UID 1000 by default
  • Created simplified docker-entrypoint-rootless.sh without chown operations
  • Added build-rootless.py to build rootless variants with -rootless suffix
  • Each regular tag now has a rootless variant (e.g., stable-rootless, latest-rootless)

Key Improvements

  • No Runtime Permission Changes: Eliminates recursive chown operations that can cause race conditions
  • Predictable Permissions: Always runs as UID 1000, making volume permissions predictable
  • Rootless Docker Compatible: Works seamlessly with rootless Docker installations
  • Better Security: Runs as non-root from the start

Documentation

  • Added comprehensive README-ROOTLESS.md with usage instructions
  • Updated main README with rootless section

How It Solves Permission Issues

The rootless images address the problems identified in #558:

  1. No more interrupted chown operations leaving files with inconsistent ownership
  2. No complex UID/GID mapping logic at runtime
  3. Directories created with open permissions (777) during build
  4. Container runs as non-root user from the start

Usage Example

# For rootless Docker users
docker run -d \
  -v ~/factorio:/factorio \
  factoriotools/factorio:stable-rootless

# For regular Docker users wanting predictable permissions
docker run -d \
  --user $(id -u):$(id -g) \
  -v /opt/factorio:/factorio \
  factoriotools/factorio:stable-rootless

Testing

  • Built and tested rootless images locally
  • Verified container starts without permission errors
  • Confirmed no chown operations occur at runtime

Compatibility

  • Maintains full backward compatibility - existing images are unchanged
  • Rootless images support all the same environment variables except PUID/PGID
  • Can be built alongside regular images using build-rootless.py

Fixes #547
Related to #558

🤖 Generated with Claude Code

Implements #547 - Add support for rootless Docker images to avoid permission issues.

Key changes:
- Add Dockerfile.rootless that runs as UID 1000 by default
- Create simplified entrypoint script without chown operations
- Add build-rootless.py to build rootless variants with -rootless suffix
- Document rootless usage in README-ROOTLESS.md
- Update main README with rootless section

The rootless images eliminate common permission problems by:
- Running as non-root from the start (USER 1000:1000)
- Avoiding recursive chown operations that can cause race conditions
- Using open permissions (777) on directories during build
- Not supporting PUID/PGID environment variables

This provides a cleaner solution for rootless Docker users and those
experiencing permission issues with volumes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@@ -0,0 +1,93 @@
# build rcon client
FROM debian:stable-slim AS rcon-builder
RUN apt-get -q update \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [hadolint] <DL3015> reported by reviewdog 🐶
Avoid additional packages by specifying --no-install-reco 8000 mmends

RUN chmod +x /*.sh

# Set proper permissions for the factorio directory
RUN chmod -R 777 /opt/factorio /factorio
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [hadolint] <DL3059> reported by reviewdog 🐶
Multiple consecutive RUN instructions. Consider consolidation.


# Update mods if requested
if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then
${INSTALLED_DIRECTORY}/docker-update-mods.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

fi

# Handle DLC
${INSTALLED_DIRECTORY}/docker-dlc.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086

if [[ -f "$SAVES/$SAVE_NAME.zip" ]]; then
echo "Map $SAVES/$SAVE_NAME.zip already exists, skipping map generation"
else
if [[ ! -z "$PRESET" ]]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck] reported by reviewdog 🐶
Use -n instead of ! -z. SC2236


# Update mods if requested
if [[ ${UPDATE_MODS_ON_START:-} == "true" ]]; then
${INSTALLED_DIRECTORY}/docker-update-mods.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
${INSTALLED_DIRECTORY}/docker-update-mods.sh
"${INSTALLED_DIRECTORY}"/docker-update-mods.sh

fi

# Handle DLC
${INSTALLED_DIRECTORY}/docker-dlc.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shellcheck (suggestion)] reported by reviewdog 🐶

Suggested change
${INSTALLED_DIRECTORY}/docker-dlc.sh
"${INSTALLED_DIRECTORY}"/docker-dlc.sh

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.

FR: Rootless-image
1 participant
0