官术网_书友最值得收藏!

  • Deployment with Docker
  • Srdjan Grubor
  • 146字
  • 2021-07-02 23:22:14

Changing the current user

We have explained why we need to run our service as a limited user and how we created the user for it, but now is the time to permanently switch the context to pythonsrv. Using USER pythonsrv, any further commands will be executed as pythonsrv user, including the container's CMD executable command, which is exactly what we want. Just like WORKDIR, this directive can be used multiple times in a Dockerfile, but for our purposes, there is no need to do the rest of the configuration as non-root. Generally, it is a good practice to keep this layer statement as high as possible in the Dockerfile since it is very unlikely that it will change and would be unlikely to break cache. However, for this example, we can't move it higher as our previous command uses chown, which requires root privileges.

主站蜘蛛池模板: 上蔡县| 鲁甸县| 广元市| 芦山县| 林口县| 莫力| 九寨沟县| 北安市| 惠州市| 同江市| 丰镇市| 乐昌市| 类乌齐县| 临武县| 灌云县| 桃江县| 文昌市| 汉中市| 娱乐| 舟山市| 孟州市| 吴川市| 河曲县| 繁昌县| 辛集市| 棋牌| 华坪县| 宝兴县| 吉安市| 辽宁省| 罗源县| 临洮县| 谷城县| 寿宁县| 会泽县| 雅江县| 灌南县| 阿鲁科尔沁旗| 东阳市| 拜城县| 钟祥市|