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

CSS to achieve chat bubble effect

1. Rendering JD Effect Simulation Effect 2. Princ...

How to get the contents of .txt file through FileReader in JS

Table of contents JS obtains the .txt file conten...

How to use JS to check if an element is within the viewport

Preface Share two methods to monitor whether an e...

Detailed explanation of simple snow effect example using JS

Table of contents Preface Main implementation cod...

How to Easily Remove Source Installed Packages in Linux

Step 1: Install Stow In this example, we are usin...

Detailed explanation of unique constraints and NULL in MySQL

Preface A requirement I had previously made, to s...

Installing Windows Server 2008 operating system on a virtual machine

This article introduces the installation of Windo...

Small problem with the spacing between label and input in Google Browser

Code first, then text Copy code The code is as fol...

Using Docker+jenkins+python3 environment to build a super detailed tutorial

Preface: After the automation is written, it need...

Detailed explanation of nginx proxy_cache cache configuration

Preface: Due to my work, I am involved in the fie...

In-depth explanation of the global status of WeChat applet

Preface In WeChat applet, you can use globalData ...

Install JDK1.8 in Linux environment

Table of contents 1. Installation Environment 2. ...

How to set list style attributes in CSS (just read this article)

List style properties There are 2 types of lists ...