How to write docker-compose

How to write docker-compose.yaml

sample


version: '3'
services:
   ubuntu:
     image: ubuntu
     container_name: ubuntu01
     tty: true
     volumes:
       - ".:/var/log"

Explain the meaning based on the sample


version: '3'
# docker-The version of compose. I rarely use anything other than 3
services: 
#Name the combination name of the container
   myweb:
#Name the combination name myweb. You can choose the name you like
     image: centos
#Specify the image of the container. When specifying the version`centos:7`Described as. If no version is specified, the latest version is automatically specified.
     container_name: my-centos
#Specify the name of the container to be created. You can choose the name you like. It is easier to understand later if you specify it.
     tty: true
#Specify that Bash is in the input waiting state (It is not necessary to specify it in the system that opens the port and listens like nginx and mysql)
     volumes:
#Specify the path to synchronize.
       - ".:/var/log"
#Host path:Describe the path to be synchronized in the form of container path. The above is the host's current directory and container/var/log directory is connected

Reference 1: Batan's technical blog

Recommended Posts

How to write docker-compose
How to write Rails
How to write Mockito
How to create docker-compose
How to write migrationfile
How to write and explain Dockerfile, docker-compose
How to write good code
Bit Tetris (how to write)
How to write java comments
[Refactoring] How to write routing
Great poor (how to write)
[Note] How to write Dockerfile/docker-compose.yml
How to write Junit 5 organized
How to write Rails validation
How to write Rails seed
[Ruby] How to write blocks
How to write Rails routing
Studying Java # 6 (How to write blocks)
[Rails] How to write in Japanese
[Rails] How to speed up docker-compose
Baseball ball count (how to write)
How to write a ternary operator
Rails on Tiles (how to write)
How to write Java variable declaration
Y-shaped road tour (how to write)
How to write easy-to-understand code [Summary 3]
[RSpec] How to write test code
How to deploy
[Basic] How to write a Dockerfile Self-learning ②
Summary of how to write annotation arguments
[Introduction to Java] How to write a Java program
[Java] How to output and write files!
How to monitor nginx with docker-compose with datadog
How to write Spring AOP pointcut specifier
How to write an RSpec controller test
[SpringBoot] How to write a controller test
JDBC promises and examples of how to write
Rails: How to write a rake task nicely
How to develop OpenSPIFe
[JavaFX] How to write Eclipse permissions in build.gradle
How to write offline 15th reference question answer
How to call AmazonSQSAsync
How to use Map
[Rails] How to write when making a subquery
How to use rbenv
Java Development Basics ~ How to Write Programs * Exercise 1 ~
How to use letter_opener_web
How to use fields_for
How to use java.util.logging
How to write an if statement to improve readability-java
How to use map
How to use collection_select
How to adapt Bootstrap
How to use Twitter4J
How to use active_hash! !!
How to install Docker
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
How to uninstall Rails
How to install docker-machine