This is the 26th day of my participation in the August More Text Challenge

If ❤️ my article is helpful, welcome to like, follow. This is the biggest encouragement for me to continue my technical creation. More previous articles in my personal column

Docker create vue project and iptables mapping problem handling

background

The first step is to create a front-end project in the Docker image as follows:

  • NPM install -g vue-cli Global installation vue-cli
  • Create a project
    • Vue create Select manual configuration
    • vue ui
  • NPM run build builds the build environment code
  • NPM run serve/NPM run dev starts webpack
    • Vue Serve Demo. Vue single-page application startup

Modifying warehouse Sources

Create or modify the /etc/docker/daemon.json file to the following format

vi /etc/docker/daemon.json

{
    "registry-mirrors": ["http://hub-mirror.c.163.com"]}Copy the code

systemctl restart docker.service

Domestic acceleration addresses are:

  • Docker China official image registry.docker-cn.com

  • Netease hub-mirror.c.163.com

  • ustc docker.mirrors.ustc.edu.cn

  • China university of science and technology, docker.mirrors.ustc.edu.cn

  • Ali Cloud container image service cr.console.aliyun.com/

Home page, click on the “create my container mirror” to get an exclusive image of accelerating address, similar to “1234 abcd.mirror.aliyuncs.com”

An exception error encountered during the procedure

iptables –wait -t nat -I DOCKER -i br-d38d92300109 -j RETURN:iptables: No chain/target/match by that name.

Cause: When docker is started, docker registers a port mapping chain with Iptables to communicate the mappings between ports exposed by containner containers managed by Docker

Run the iptables -l command to view the iptables port mapping chain

In a development environment, Docker will raise an Iptables Error if you remove the docker-associated port mapping chain in Iptables, or if the iptables network rules are lost as a result (for example, restarting Firewalld). Such as:

Failed programming External connectivity… iptables: No chain/target/match by that name

To resolve this issue, simply restart the Docker service and the correct iptables port mapping rules will be automatically recreated

Guide post

  • Docker-compose installs the LNMP environment
  • Deploy the SpringBoot project using Jenkins, Docker, and GitLab