Skip to content

There is a problem creating a stack that contains a semicolon environment variable using the portainer API. #12535

Closed Answered by Aaron-Bae
Aaron-Bae asked this question in Help
Discussion options

You must be logged in to vote

I was able to solve the problem. Instead of using "-F" I changed it to "--form-string" so that I can use the semi-colon inside my $ENV_JSON.

Before:
curl -s -X POST curl -s -X POST "$PORTAINER_URL/stacks/create/swarm/file?endpointId=$ENDPOINT_ID"
-H "X-API-Key: $ACCESS_TOKEN"
-H "Content-Type: multipart/form-data"
-F "Name=$STACK_NAME"
-F "SwarmID=$SWARM_ID"
-F "file=@$COMPOSE_FILE"
-F "Env=$ENV_JSON"
-F "Prune=true"

After:
curl -s -X POST "$PORTAINER_URL/stacks/create/swarm/file?endpointId=$ENDPOINT_ID"
-H "X-API-Key: $ACCESS_TOKEN"
-H "Content-Type: multipart/form-data"
-F "Name=$STACK_NAME"
-F "SwarmID=$SWARM_ID"
-F "file=@$COMPOSE_FILE"
--form-string "Env=$ENV_JSON"
-F "…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Aaron-Bae
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Aaron-Bae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants