Elastic Container Instance (ECI) runs a container by using predefined parameters in the container image. You can set the following fields in the configuration file of an ECI to override the default settings in the image:

  • WorkingDir: the working directory.
  • Commands: the command to run.
  • Args: the command parameters.

WorkingDir

When you create an image, you can set the WORKDIR field to specify the working directory of a container when it is run. You can override the default setting provided by the image by setting the WorkingDir field in the configuration file of an ECI.
Notice If the WORKDIR field is not set in the image and the WorkingDir field is not set for the ECI, the working directory is set to the root directory (/) by default. If the specified directory does not exist, it is created automatically.

Commands and Args

If you set the Commands and Args fields when you create an ECI, their values override those of the ENTRYPOINT and CMD fields that you specify when you create the image. The following table describes how these fields work.

ENTRYPOINT CMD Commands Args Command run Description
[mkdir] [/data/backup] Not set Not set [mkdir /data/backup] If the Commands and Args fields are not set, the default settings in the image are used.
[mkdir] [/data/backup] [cd] Not set [cd /data/backup] If the Commands field is set whereas the Args field is not, the command specified by the Commands field is run, and the command specified by the CMD field is ignored.
[mkdir] [/data/backup] Not set [/opt/backup] [mkdir /opt/backup] If the Args field is set whereas the Commands field is not, the command specified by the ENTRYPOINT field is run with the parameters specified by the Args field.
[mkdir] [/data/backup] [cd] [/opt/backup] [cd /opt/backup] If both the Commands and Args fields are set, the command specified by the Commands field is run with the parameters specified by the Args field.
Notice The values of Commands and Args must be supported by a container image. Otherwise, the container fails to run. For more information, see Define a Command and Arguments for a Container.