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

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.

主站蜘蛛池模板: 牙克石市| 千阳县| 富顺县| 英德市| 翁牛特旗| 出国| 宜章县| 湾仔区| 芒康县| 义乌市| 威远县| 平陆县| 兴宁市| 平山县| 桂东县| 准格尔旗| 万年县| 临桂县| 夹江县| 永平县| 广平县| 河池市| 温州市| 济南市| 宿迁市| 龙南县| 新野县| 潮州市| 汝城县| 潍坊市| 金湖县| 托克托县| 大洼县| 句容市| 阿克陶县| 莎车县| 五寨县| 阿拉善左旗| 松溪县| 汉沽区| 温泉县|