Common commands for docker compose configuration files

Source: Internet
Author: User
Tags custom name docker compose

Common commands for docker compose configuration files

Precautions for yaml file format and writing

  • Yaml is an intuitive data serialization format with high readability. Similar to the XML Data Description Language, The syntax is much simpler than XML.
  • The yaml data structure is represented by indentation. Consecutive items are represented by minus signs. Key-value pairs are separated by colons, arrays are enclosed by brackets, and hash is enclosed by curly brackets..

Considerations for yaml file format:

  • 1. Tab key indentation is not supported, and space indentation is required.
  • 2. Generally, two spaces are indented at the beginning.
  • 3. One space is indented after the character,

# Build the image context path

Build

# Specify the dockefile name

Dockerfile

# From Image

Image

# Build parameters. The parameter specified in dockerfile

ARGs

# Override default commands

Command

# Customize the container name. If the custom name is used, the service cannot be scaled out of 1 container.

Container_name

# Specify the configurations related to deployment and operation. Version 3

Deploy

# Dependencies between services to control the service startup sequence. Normally, the service is started in order.

Depends_on

# Custom DNS server, which can be a single value or list

DNS

# Override entrypoin

Entrypoint

# Add an environment variable from a file, which can be a single value or a list

Env_file

# Add environment variables, which can be arrays or dictionaries. Boolean values are enclosed in quotation marks.

Environment

# Declare the Container Service port

Expose

# Connect to another container

Links

# Connecting containers other than compose

External_links

# Add a host name ing, which is the same as-addhost.

Extra_hosts

# Record the Service Log. Same as-logdriver

Logging

# Network mode, same as-Net

Network_mode

# The network to be added.

Networks

# Specify the static IP address of the container for the service when you join the network

Aliases

Ipv4_address, ipv6_address

# Set the PID mode to the host PID mode to share the PID address space with the host. PID: "host"

PID

# Expose the port, which is the same as-P. But the port is no less than 60

Port

# Set Kernel Parameters in the container, which can be arrays or dictionaries.

Sysctl

# Overwrite the container's default ulimits

Ulimits

# Mount a directory or an existing data volume container to the container

Volume

# No, always | onfailure | unless-stopped

Restart

# Host Name

Hostname

# Working directory

Working_di

 

More commands:Https://docs.docker.com/compose/compose-file/compose-file-v2/

 

Common commands for docker compose configuration files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.