This topic describes the parameters that are related to application configuration.

Swarm parameter Description Corresponding Kubernetes parameter Sample Swarm configuration Sample Kubernetes configuration How to migrate
name

The service name. This parameter has no special use and can be ignored.

Not supported in Kubernetes. - - No need to migrate.
image The container image. image - - Automatically converted by Kompose.
ports The container ports. containerPort. You must create a NodePort service if your Kubernetes cluster is accessed by external systems. - - Automatically converted by Kompose.
environment The environment variables. env - - Automatically converted by Kompose.
volumes The directories or volumes of the host, which are used by the container.

volumeMounts

volumes

For more information, see the sample Swarm configuration in volumes. For more information, see the sample Kubernetes configuration in volumes. Automatically converted by Kompose.
cap_add/cap_drop Grants or revokes the permissions of the container to modify the kernel. securityContext: capabilities For more information, see the sample Swarm configuration in cap_add/cap_drop. For more information, see the sample Kubernetes configuration in cap_add/cap_drop. Automatically converted by Kompose.
privileged: true

Grants privileged permissions to the root account of the container. If privileged: true is not specified, the root account of the container only possesses permissions of a general user.

In a container that starts in the privileged mode, you can view devices of the host. You can also mount devices to the container. You can even start another Docker container in the container.

securityContext: privileged For more information, see the sample Swarm configuration in privileged: true. For more information, see the sample Kubernetes configuration in privileged: true. Automatically converted by Kompose.
mem_limit The maximum memory usage of the container. resource: request/limits For more information, see the sample Swarm configuration in mem_limit. For more information, see the sample Kubernetes configuration in mem_limit. Automatically converted by Kompose.
cpu_shares The maximum CPU usage of the container. resource: request/limits For more information, see the sample Swarm configuration in cpu_shares. For more information, see the sample Kubernetes configuration in cpu_shares. Automatically converted by Kompose.
kernel_memory The same as the corresponding parameter of the docker run command. Not supported in Kubernetes. - - No need to migrate.
memswap_reservation The same as the corresponding parameter of the docker run command. Not supported in Kubernetes. - - No need to migrate.
memswap_limit The same as the corresponding parameter of the docker run command. Not supported in Kubernetes. - - No need to migrate.
shm_size The same as the corresponding parameter of the docker run command. Not supported in Kubernetes. - - No need to migrate.
oom-kill-disable Specifies whether to disable the Out of Memory (OOM) killer for the container. It has the same meaning as the --oom-kill-disable parameter of the docker run command. Not supported in Kubernetes. - - No need to migrate.

volumes

Sample Swarm configuration Sample Kubernetes configuration
volumes volumes

For more information, see auth-service-deployment.yaml.

cap_add/cap_drop

Sample Swarm configuration Sample Kubernetes configuration
cap_add cap_add/cap_drop

For more information, see auth-service-deployment.yaml

privileged: true

Sample Swarm configuration Sample Kubernetes configuration
privileged: true privileged: true

For more information, see auth-service-deployment.yaml.

mem_limit

Sample Swarm configuration Sample Kubernetes configuration
mem_limit mem_limit

For more information, see config-deployment.yaml.

cpu_shares

Sample Swarm configuration Sample Kubernetes configuration
cpu_shares cpu_shares

For more information, see config-deployment.yaml.