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

  • 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.

主站蜘蛛池模板: 应城市| 博客| 渭南市| 元江| 延津县| 南木林县| 麦盖提县| 满洲里市| 铁力市| 青岛市| 涟源市| 台南市| 垣曲县| 共和县| 华池县| 泰来县| 苗栗市| 搜索| 巴塘县| 封丘县| 舟山市| 鹤壁市| 张北县| 镇雄县| 永定县| 油尖旺区| 房山区| 永城市| 峨边| 诸城市| 五原县| 临武县| 运城市| 诸暨市| 洛隆县| 桦川县| 南昌市| 大足县| 陕西省| 陇西县| 曲阳县|