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
Table of contents Preface Install Introduction Sw...
Generally speaking, we can have the following two...
You must have saved other people’s web pages and l...
The company's business scenario requires the ...
In the past few days, I have studied how to run s...
Preface Let me share with you how to make a searc...
<br /> When we browse certain websites and s...
The solution to the problem that Navicat cannot r...
Given a div with the following background image: ...
1. Packaging Vue project Enter the following name...
When configuring proxy_pass in nginx, if you matc...
So after registering a domain name and purchasing...
When using the docker-maven-plugin plug-in, Maven...
Cocos Creator version: 2.3.4 Demo download: https...
CSS3 can create animations, which can replace man...