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

Complete steps to quickly build a vue3.0 project

Table of contents 1. We must ensure that the vue/...

Implementing search box function with search icon based on html css

Preface Let me share with you how to make a searc...

How to use axios to make network requests in React Native

In front-end development, there are many ways to ...

Four ways to combine CSS and HTML

(1) Each HTML tag has an attribute style, which c...

Example of using CSS to achieve floating effect when mouse moves over card

principle Set a shadow on the element when hoveri...

Problems with nodejs + koa + typescript integration and automatic restart

Table of contents Version Notes Create a project ...

Sample code for programmatically processing CSS styles

Benefits of a programmatic approach 1. Global con...

Docker deploys mysql to achieve remote connection sample code

1.docker search mysql查看mysql版本 2. docker pull mys...

VMware and CentOS system installation method to reset the root password

Today's Tasks 1. Choice of Linux distribution...

How to change the website accessed by http to https in nginx

Table of contents 1. Background 2. Prerequisites ...

Graphic tutorial on installing Ubuntu 18.04 on VMware 15 virtual machine

In the past few years, I have been moving back an...

How to bypass unknown field names in MySQL

Preface This article introduces the fifth questio...