feat: allow passing labels to one-off dokku containers

This feature is allows users to add extra label metadata to one-off containers. As this can interfere with Dokku internals if they shadow labels used by plugins, care should be taken to avoid the `com.dokku` or `org.label-schema` namespace.

Also proper name run containers so they don't get random names from docker...
This commit is contained in:
Jose Diaz-Gonzalez
2019-09-16 23:07:01 -04:00
parent a3ef91f2ae
commit 798725bb54
4 changed files with 39 additions and 3 deletions

View File

@@ -111,12 +111,17 @@ assert_urls() {
@test "(core) run (detached)" {
deploy_app
RANDOM_RUN_CID="$(dokku --detach run $TEST_APP sleep 300)"
RANDOM_RUN_CID="$(dokku --label=com.dokku.test-label=value --detach run $TEST_APP sleep 300)"
run /bin/bash -c "docker inspect -f '{{ .State.Status }}' $RANDOM_RUN_CID"
echo "output: $output"
echo "status: $status"
assert_output "running"
run /bin/bash -c "docker inspect $RANDOM_RUN_CID --format '{{ index .Config.Labels \"com.dokku.test-label\" }}'"
echo "output: $output"
echo "status: $status"
assert_output "value"
run /bin/bash -c "docker stop $RANDOM_RUN_CID"
echo "output: $output"
echo "status: $status"