!

preface

What are the front-end analog data tools that are easy to use? Many people don’t think: “EasyMock!!” My answers are surprisingly consistent. Tools are great tools, but the service is really not that stable. But this also can’t complain, after all can provide open source code, somebody else already very 🐂🍺! As a front end, it was a bit of a hassle to deploy the EasyMock development environment on the computer. Mongoes and Redis were installed, there were a lot of problems to debug, and it took hours to deploy, and I’m a bit of a space management freak. So I decided to use the recently popular DCoker to deploy an EasyMock.

What is a docker?

Docker is an open source application container engine that allows developers to package their applications and dependencies into a portable image that can then be distributed to any popular Linux or Windows machine, as well as virtualization. Containers are completely sandboxed and have no interface with each other. I understand the plain words: is a container type of virtual machine, container, complete isolation and other environmental isolation.

Install the docker

The recommended tool here is Docker Desktop, fool type installation can be.

After installation, it is divided into images and containers. All downloaded packages shown in images can also be understood as images and containers are apps installed using images. Specific knowledge is not detailed, interested in the system can go online learning.

1. Next is an officially provided warehouse, dockerHub, from which you can find and download the required image. Here we search for easyMock. The command from the official website is:

docker pull easymock/easymock
Copy the code

Once you’ve downloaded it, you’ll find an image of EasyMock/EasyMock in images in the new screen

Official offers a docker – compose yml file, this is also the docker common knowledge Dokcer compose method of use. In fact, this configuration file is used to configure all the services required by the application. Also very simple, the method is as follows:

  1. Switch the source
The curl -l https://get.daocloud.io/docker/compose/releases/download/1.25.0/docker-compose- ` ` uname - s - ` uname -m ` > /usr/local/bin/docker-composeCopy the code
  1. The docker-compose up command will generate an error if the docker-compose up command is executed
sudo chmod +x /usr/local/bin/docker-compose
Copy the code

4. Create a docker-comemess. yml file in a directory, copy the following code, and modify the configuration of the comment. /data/db:/data/db :/data/db :/data/db :/data/db :/data/db :/data/db To change the address, just change the address before the colon.

Version: '3' services: mongodb: image: mongo: /data/db:/data/db' networks: -easy-mock restart: always redis: image: Redis :4.0.6 command: redis-server --appendonly yes volumes: #./data/redis - './data/redis:/data' networks: - easy-mock restart: always web: image: Easymock/easyMock :1.6.0 command: /bin/bash -c "NPM start" ports: -7300 :7300 volumes: /logs:/home/easy-mock/easy-mock/logs' Please use the local configuration address to replace # - '. / production. Json: / home/easy - a mock/easy - a mock/config/production. Json 'networks: - easy - the mock restart: always networks: easy-mock:Copy the code

Docker-compose up -d will automatically help you download and configure the docker-compose service. There is a long wait time, including Mongoes, Redis, and easyMock.

When you’re done, go to localhost:7300 (if you need to change the port, change it in the YML configuration file) to access EasyMock! A fun!

summary

The above content is not a Docker tutorial, just hope through the simplest way to recommend a good tool to improve your efficiency. If you have any suggestions for this article, I will listen to them patiently and humbly accept their ideas!