Created
June 17, 2025 09:49
-
-
Save stephankoelle/41325150a6aa66eca8d04ed6839523f2 to your computer and use it in GitHub Desktop.
podman systemd service (with quadlet) starting a private container with ecr login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# custom.container | |
# | |
# This does login into ECR and starts a private container on boot with podman and quadlet / systemd. | |
# The container is running rootless, the systemd service is a 'user' service | |
# This is build to work on Fedora CoreOS, even the aws-cli does not need to be installed, it's used from aws public container repo. | |
# You need to have valid aws credentials in ~/.aws/ | |
# Replace the *** with your correct aws ecr url | |
# | |
# This file was partly generated with podlet | |
# | |
# Store in: ~/.config/containers/systemd/custom.container (create the dir if it does not exist) | |
# | |
# systemctl --user daemon-reload | |
# systemctl --user start custom.service | |
# systemctl --user status custom.service | |
# journalctl --user -fu custom.service | |
# | |
# | |
[Container] | |
ContainerName=custom | |
Image=***.dkr.ecr.eu-central-1.amazonaws.com/custom:latest | |
Network=host | |
PidsLimit=0 | |
PodmanArgs=--log-opt 'max-size=2048m' --log-opt 'max-file=6' | |
[Install] | |
# Start by default on boot | |
WantedBy=multi-user.target default.target | |
[Service] | |
ExecStartPre=-bash -c "podman run --pull always -v %h/.aws:/root/.aws --rm public.ecr.aws/aws-cli/aws-cli ecr get-login-password --region eu-central-1 | podman login --username AWS --password-stdin ***.dkr.ecr.eu-central-1.amazonaws.com" | |
[Service] | |
Restart=always | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment