All Products
Search
Document Center

Elastic Compute Service:Commands supported by Image Builder

Last Updated:Jan 22, 2024

This topic describes commands supported by Image Builder, including specific Dockerfile commands. Familiarize yourself with the commands to get started with Image Builder.

The following table describes the commands supported by Image Builder.

Command

Format or example

Description

FROM

  • FROM IMAGE:<Image ID>

  • FROM IMAGE_FAMILY:<Image family name>

Specify a source image.

  • This command is not supported by image components.

  • After you configure a source image in an image template, the system automatically generates a FROM command based on the source image.

Note

If you specify a FROM command and a source image in an image template, the FROM command that you specify overwrites the automatically generated FROM command.

COMPONENT

COMPONENT ic-bp18hy47cqavewsb****

Specify image components. You can specify system components or custom components. The command is applicable only to image templates. When you create an image template, you can run the command to specify one or more image components in the image template.

RESTART

RESTART

Restart the instance. Do not add parameters to the command.

RUN

RUN echo hello;\
echo world;

Build an image. The command can be split into multiple lines. An escape character (\) must be added to the end of each line except for the last line.

ENV

  • ENV key value

  • ENV key1="value1" key2="value2"

Configure environment variables. Pass environment variables in the key="value" format into the command.

Note

Double quotation marks (") are required before and after the value of each environment variable in the command. Example: ENV key1="value1" key2="value2".

WORKDIR

  • WORKDIR /<path>

  • WORKDIR <path1>/<path2>

Configure working directories.

COPY

  • COPY {Network file address} <On-premises directory>

  • COPY <On-premises file path> <On-premises directory>

Copy files.

Note

Network files must be downloaded by using the wget utility, and query strings are not supported in URLs. In addition, intermediate instances must be able to access the Internet.

USER

USER <username>

Specify a user.

Note

Set the <username> variable to an existing username. Otherwise, an error is reported after the command is run.

LABEL

LABEL user="username"\
date="2020-11-11" key="value"

Add metadata to the image template. The command can be split into multiple lines. An escape character (\) must be added to the end of each line except for the last line.

CMD

  • CMD ["executable","param1","param2"]

  • CMD command param1 param2

Specify commands that run on instance startup.

ENTRYPOINT

  • ENTRYPOINT ["executable","param1","param2"]

  • CMD command param1 param2

Specify commands that run on instance startup.

References

For more information about Dockerfile commands, such as the differences between CMD and ENTRYPOINT commands, see Dockerfile reference.