Last active
September 9, 2022 08:08
-
-
Save prog/48341108404cae266d72ed4a470c1bc3 to your computer and use it in GitHub Desktop.
How to run service in docker-compose as current user
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
version: '3' | |
services: | |
greeter: | |
image: alpine:latest | |
volumes: | |
- "/etc/passwd:/etc/passwd:ro" | |
- "/etc/group:/etc/group:ro" | |
environment: | |
- "USER=${USER}" | |
command: su -s /bin/sh "${USER}" -c 'echo "Hello, I am $$(whoami)!"; id' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment