I would like to run curl inside a docker image. It is working in docker container like this:
curl -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel":"INFO"}' localhost:8091/mobile-svc/actuator/loggers/something
when I want to run it from a bash script out from docker container like this:
args="sh -c \"curl -i -X POST -H 'Content-Type: application/json' -d'{\"configuredLevel\":\"${LEVEL}\"}' localhost:${PORT}/mobile-svc/actuator/loggers/${PACKAGE}\""
echo $args
cmd="docker exec -it $CID $args"
eval $cmd
it said:
sh -c "curl -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel":"DEBUG"}'
localhost:8091/tcp/mobile-svc/actuator/loggers/something
HTTP/1.1 404
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Sat, 08 Aug 2020 12:49:58 GMT
{"timestamp":"2020-08-08T12:49:58.949+0000","status":404,"error":"Not Found","message":"No message available","path":"/tcp/mobile-svc/actuator/loggers/something"}
How can I pass compound parameters to curl?
thx Zamek