Skip to content

Commit 2e9384b

Browse files
authored
Merge pull request #54 from andygrunwald/container_user
Add support for docker run `--user`
2 parents 4095dfb + dbdce3d commit 2e9384b

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ This will create:
5353
* `container_cap_add` (default _[]_) - List of capabilities to add
5454
* `container_cap_drop` (default _{}_) - List of capabilities to drop
5555
* `container_network` (default _""_) - [Network settings](https://docs.docker.com/engine/reference/run/#network-settings)
56+
* `container_user` (default _""_) - [User settings](https://docs.docker.com/engine/reference/run/#user)
5657
* `container_devices` (default _[]_) - List of devices to add
5758
* `container_privileged` (default _false_) - Whether the container should be privileged
5859
* `container_start_post` - Optional command to be run by systemd after the container has started

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ container_labels: []
66
container_cmd: []
77
container_host_network: false
88
container_network: ""
9+
container_user: ""
910
container_links: []
1011
container_ports: []
1112
container_volumes: []

templates/unit.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ExecStart={{ docker_path }} run \
2828
{{ params('--volume', container_volumes) }}\
2929
{% if container_host_network == true %}--network host {% else %}{{ params('--publish', container_ports) }}{% endif %}\
3030
{% if container_network %}--network {{ container_network }}{% endif %} \
31+
{% if container_user %}--user {{ container_user }}{% endif %} \
3132
{{ params('--link', container_links) }}\
3233
{{ params('--label', container_labels) }}\
3334
{{ params('--cap-add', container_cap_add) }}\

0 commit comments

Comments
 (0)