在Dockerfile中定义了一个env变量,如下:
Dockerfile
env
... ENV MY_ENV dev CMD ["pm2","start", "pm2.json"," --env ${MY_ENV}","--no-daemon"] ...
想在镜像RUN的时候,把env变量给替换成指定的,写出如下:
RUN
docker run -e "MY_ENV=staging" --name pm2_test -p 3500:3500 -d pm2_test:v1
问: 为啥变量不起作用?
This is how it is
CMD pm2 start pm2.json --env ${MY_ENV} --no-daemon
This is how it is