First submission, writing this article is mainly to record myself this week from 0 to learn docker deployment project.

  • Image: The application and its dependencies are packaged in an image file. You can think of it as a class.
  • Container: Image A container instance generated by the image file is also a file. Think of it as an instance of a class.
  • Repository: equivalent to Github, you can upload your own images to it.
  • .dockerfile: the file used to generate the image.
  • Docker-comemage. yml: a file used to execute multiple containers.

Package the front-end VUE project, and then put the packaged files on the back-end server.

Create a Dockerfile file to create the image on the back end



Configure docker-comemage. yml to start our project

Docker-compose up -d: docker-compose up -d: docker-compose up -d: docker-compose up -d: docker-compose up -d



Note:

  • Start the mongodb service after the blog service is started.
  • The mapping paths in volumes are relative paths, not absolute paths in CMD
  • The 172.19.0.2 address for connecting to the mongodb service must be configured in advance
  • The above configuration can be found in the Server folder on Github

Github:github.com/soymikey/pe…

The server directory contains back-end files, dockerfile, and docker-compose

If you have any questions, please leave them in the comments section.