zoukankan      html  css  js  c++  java
  • 【Docker】Dockerfile 之 USER

    参考教程:https://docs.docker.com/engine/reference/builder/

    环境

    1. virtual box 6.1
    2. centos 7.8
    3. docker 19.03

    USER

    USER <user>[:<group>]
    

    or

    USER <UID>[:<GID>]
    

    The USER instruction sets the user name (or UID) and optionally the user group (or GID) to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.

    USER 指令设置运行镜像时要使用的用户名(或 UID)以及可选的用户组(或 GID),以及 Dockerfile 中跟随该镜像的所有 RUNCMDENTRYPOINT 指令。

    Note that when specifying a group for the user, the user will have only the specified group membership. Any other configured group memberships will be ignored.

    请注意,在为用户指定组时,用户将仅具有指定的组成员身份。任何其它已配置的组成员身份将被忽略。

    Warning

    When the user doesn’t have a primary group then the image (or the next instructions) will be run with the root group.

    On Windows, the user must be created first if it’s not a built-in account. This can be done with the net user command called as part of a Dockerfile.

    警告

    当用户没有主要组时,该镜像(或后续指令)将与 root 组一起运行。

    在 Windows 上,如果不是内置帐户,则必须首先创建该用户。这可以通过作为 Dockerfile 的一部分调用的e net user 命令来完成。

    FROM microsoft/windowsservercore
    # Create Windows user in the container
    RUN net user /add patrick
    # Set it for subsequent commands
    USER patrick
    

    总结

    介绍了 Dockerfile 中 USER 指令的用法和注意事项。

  • 相关阅读:
    1009 说反话 (20 分)
    1007 素数对猜想 (20 分)
    Visual Studio2017下载方法
    百词斩和扇贝打卡测试与评估
    创建者模式->工厂模式
    STM32F427|----------IO讲解与应用
    MySQL的索引
    STM32F103RCt6 与 MG996R
    2020物联网实验室的考核题目
    初学数据库-MySQL&IDEA&Navicat
  • 原文地址:https://www.cnblogs.com/jiangbo44/p/14117315.html
Copyright © 2011-2022 走看看