Help Center> Cloud Container Instance> Best Practices> Workload Creation> Configuring Dockerfile Parameters for CCI
Updated on 2024-01-16 GMT+08:00

Configuring Dockerfile Parameters for CCI

Scenario

Dockerfiles are generally used to customize images. A Dockerfile is a text file that contains instructions, each of which builds an image layer.

This topic describes the CCI settings corresponding to the Dockerfile configurations.

Using Dockerfile Parameters in CCI

The following uses an example to describe the relationship between them.

FROM ubuntu:16.04

ENV VERSION 1.0

VOLUME /var/lib/app

EXPOSE 80

ENTRYPOINT ["./entrypoint.sh"]
CMD ["start"]

In the preceding example, the Dockerfile contains common parameters, including ENV, VOLUME, EXPOSE, ENTRYPOINT, and CMD. These parameters can be configured for CCI as follows:

  • ENV indicates an environment variable. Corresponding to ENV VERSION 1.0 in the Dockerfile, set Environment Variables in the advanced settings as follows when creating a workload on the CCI console.

  • VOLUME indicates a container volume. Generally, this parameter is used together with docker run -v host path:container volume path.

    For CCI, Elastic Volume Service (EVS) disks can be mounted to containers. You only need to add EVS volumes, and configure their sizes and mount paths (that is, container volume paths) when creating workloads.

  • ENTRYPOINT and CMD correspond to the startup command of the advanced settings in CCI. For details, see Setting Container Startup Commands.

  • EXPOSE indicates an exposed port. Generally, this parameter is used together with docker run -p <host port>:<container port> when a container is started. To set an exposed port for a CCI container, you only need to configure the Workload access port:Container port when creating a workload. In this way, you can access the container through the Workload domain name:Workload access port.