There are many ways to implement the requirement described in the title. As a starting point, let’s start with the simplest way.

First use the command docker ps to ensure that no docker instances are currently running.

Docker run -it nginx: open another terminal, use docker ps command to check the running container instance, Status Up 54 seconds means that 54 seconds have passed since the start of the instance.

Enter the container instance with the command:

docker exec -it bbc5d48a761c /bin/shCopy the code

Once inside, we see the shell prompt #, and we can execute some common commands inside the nginx container.

/usr/share/nginx/html is where the nginx server will store the web application. Now we just need to find a way to put our Web application in this folder.

I provide a sample Web application available on my Github: github.com/i042416/jer…

The problem is how to get the Web application into the appropriate folder within the container.

I use docker volume to realize data sharing between docker and host. Use Docker stop to stop the original docker instance and start the new one.

Suppose I downloaded the github webApp folder I provided to the ~ directory, and then attached the webapp folder to the nginx container with the following command line:

docker run -d -p 1081:80 -v `pwd`/webapp:/usr/share/nginx/html/webapp --name jerry-custom nginxCopy the code

This article is from “Wang Zixi”, a partner of the cloud habitat community. For relevant information, you can follow the wechat public account “Wang Zixi”.