Docker Compose is a Docker tool for defining and running complex applications. With Docker Compose you no longer need to use shell scripts to start containers. (Configured via docker-compose.yml) Installation of Docker Compose Github Source sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose # Add executable permissions to docker-compose sudo chmod +x /usr/local/bin/docker-compose Daocloud Source curl -L https://get.daocloud.io/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose # Add executable permissions to docker-compose sudo chmod +x /usr/local/bin/docker-compose Uninstalling Docker Compose sudo rm /usr/local/bin/docker-compose Check the version of Docker Compose docker-compose --version Configure Dockerfile #Specify the base image and customize it FROM java:8 #Maintainer information MAINTAINER zhouzhaodong <[email protected]> #Set the working directory WORKDIR /apps/demo #Add demo-0.0.1-SNAPSHOT.jar to the container ADD demo-0.0.1-SNAPSHOT.jar demo-1.0.0.jar #Execute in bash mode to make demo-1.0.0.jar accessible. #RUNCreate a new layer and execute these commands on it. After the execution is completed, commit the changes of this layer to form a new image. RUN bash -c "touch /demo-1.0.0.jar" #Declare the service port provided by the runtime container. This is just a declaration. The application will not open the service of this port at runtime because of this declaration. EXPOSE 8080 #Specify the container startup program and parameters <ENTRYPOINT> "<CMD>" ENTRYPOINT ["java","-jar","demo-1.0.0.jar"] Configure the docker-compose.yml file # Version: '3.0' services: demo: # build is used to specify the file path where the Dockerfile is located build: . # Mapping ports ports: - "8080:8080" volumes: #Specify a file directory to store container data. # $PWD represents the current path - $PWD/data:/var/lib/log Common commands for docker-compose build: #Build image without cache docker-compose build --no-cache; up: # Build and start the container docker-compose up -d down: # Delete all containers, mirror docker-compose down restart: #Restart the container docker-compose build; docker-compose down; docker-compose up -d Run the docker-compose command to build and run the image
The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: How to implement MySQL bidirectional backup
>>: Vue mobile terminal realizes finger sliding effect
1. Property List Copy code The code is as follows:...
Table of contents mysql log files binlog Binlog l...
Today I will talk to you about clearing floats. B...
Table of contents background CommonsChunkPlugin s...
Table of contents Introduction Example: Event del...
This article uses examples to illustrate the usag...
Table of contents Preface 1. Background 2. Simula...
Table of contents Design scenario Technical Point...
Why does CSS have a cascading mechanism? Because ...
Table of contents 1. The principle of index push-...
1. Rendering 2. Source code HTML < body > &...
Install Docker Update the yum package to the late...
1. Click the server host and click "Virtual ...
remember: IDE disk: the first disk is hda, the se...
1. The ul tag has a padding value by default in M...