Docker-compose installation yml file configuration method

Docker-compose installation yml file configuration method

1. Offline installation

https://github.com/docker/compose/releases

Move files

mv docker-compose-linux-x86_64 /usr/local/bin

Modify the file name

mv docker-compose-linux-x86_64 docker-compose

Grant execution permissions to docker-compose. By default, there is no execute permission.

chmod -x docker-compose

Whether the test is successful

docker-compose -v

2. Online installation

run

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Install a different version and modify the version number to 1.29.2.

If you encounter curl problems, use pip to install

pip install docker-compose

Without virtualenv

implement

sudo pip install docker-compose

Grant execution permissions to docker-compose. By default, there is no execute permission. In /usr/local/bin

chmod -x docker-compose

Whether the test is successful

docker-compose -v

3. Uninstall

sudo rm /usr/local/bin/docker-compose

Installed using pip

pip uninstall docker-compose

4. Define the yml file

1. Download the nginx image

docker pull nginx

2. Write the docker-compose.yml file. Pay attention to the format of the YML file.

version: '3' #version number services: #docker container nginx: #container name container_name: nginx-1 #customize the container name after startup restart: always #Set to always, indicating that this container should always restart when stopped image: nginx:latest #image name: version number ports: #startup port number - 4433:80
    volumes: #Data volume, mapping files in the container to the server - ./conf.d:/etc/nginx/conf.d
    environment: #Environment configuration TZ: Asia/shanghai

3. Start. Under the yml file

docker-compose up -d

This is the end of this article about docker-compose installation and yml file configuration. For more relevant docker-compose yml file configuration content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker compose configuration file writing and command usage examples
  • Using Docker Compose to build and deploy ElasticSearch configuration process
  • Detailed explanation of the process of deploying the distributed configuration center Apollo with one click using docker compose
  • Detailed tutorial on docker-compose deployment and configuration of Jenkins
  • How to install and configure the Docker Compose orchestration tool in Docker.v19
  • Docker-compose steps to configure the spring environment
  • Detailed explanation of software configuration using docker-compose in linux
  • Detailed explanation of Docker Compose configuration file parameters

<<:  Vue codemirror realizes the effect of online code compiler

>>:  MySQL executes commands for external sql script files

Recommend

How to disable ads in the terminal welcome message in Ubuntu Server

If you are using the latest Ubuntu Server version...

Markup Languages ​​- Lists Again

Click here to return to the 123WORDPRESS.COM HTML ...

Detailed example of MySQL (5.6 and below) parsing JSON

MySQL (5.6 and below) parses json #json parsing f...

Detailed explanation of Vue slot

1. Function : Allows the parent component to inse...

Three JavaScript methods to solve the Joseph ring problem

Table of contents Overview Problem Description Ci...

Analysis of slow insert cases caused by large transactions in MySQL

【question】 The INSERT statement is one of the mos...

How to elegantly implement WeChat authorized login in Vue3 project

Table of contents Preface Prepare Implementation ...

Summary of MySQL's commonly used concatenation statements

Preface: In MySQL, the CONCAT() function is used ...

JavaScript Basics Variables

Table of contents 1. Variable Overview 1.1 Storag...

A brief analysis of the configuration items of the Angular CLI release path

Preface Project release always requires packaging...

Detailed introduction to Mysql date query

Query the current date SELECT CURRENT_DATE(); SEL...

Conditional comments to determine the browser (IE series)

<!--[if IE 6]> Only IE6 can recognize <![...

In-depth analysis of the Linux kernel macro container_of

1. As mentioned above I saw this macro when I was...