There are generaly two options, because docker doesn’t support this feature now:
-
Create your own script, which will act like runner for your command. For example:
#!/bin/bash export VAR1=VAL1 export VAR2=VAL2 your_cmd
-
Run your command following way:
docker exec -i CONTAINER_ID /bin/bash -c "export VAR1=VAL1 && export VAR2=VAL2 && your_cmd"