I have encountered many problems in learning Docker and actual operation recently, so I wrote a blog to record them. InstallI installed the Windows version Docker desktop, it is quite troublesome to use Docker on Windows, you need to configure some things, install Docker desktop on Windows. After the installation is complete, you can usually run it as an administrator. If you encounter an error message "Docker Access Denied" and cannot open it, you need to add the current user of the computer to In the docker-users user group. Open the command line tool and enter the following command to check whether Docker is installed successfully: You can even run a hello-world: Packaging imageWe all know that the packaging command is docker build , in addition to this, requires a I won’t introduce the Dockerfile file or command line packaging, but I will share a vscode plug-in called Docker! After installation, there will be a small whale in the sidebar, and we can see the status and image of the container, provided that Docker Desktop is successfully installed. Then right-click on our Dockerfile file and click build image. You will be prompted to enter a name for the image, then press Enter. Run the container and add environment variablesSometimes the normal operation of the project depends on some environment variables, which we can The -e directive adds: docker run -p 4000:4000 -e env1=xxxx -e env2=yyyy ImageID Run the container and customize the container nameWe run hello-world twice and then open docker desktop. We can see that the container name seems to be randomly assigned each time. We can use –name specifies the name of the container: docker run --name hello hello-world Running results: Docker modify hostWhen running a new container using docker run, pass the parameter –add-host to add the domain name and IP information to the container’s /etc/hosts file: docker run -p 8080:8080 --add-host=hostname:127.0.0.1 ImageID Export the image to localAfter we develop and package the project into an image, we may need to deploy and test it for operation and maintenance or backend personnel. We can use The save -o command exports the image: docker save -o .\saved path\image file name Image example: dicker save -o .\Desktop\hello.tar hello-world Personally, I think it would be more convenient to use docker hub! This is the end of this article about Docker packaging images and configuration modification. For more relevant Docker packaging images and configuration content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Beginners learn some HTML tags (3)
>>: In-depth study of MySQL composite index
cause I once set up WordPress on Vultr, but for w...
Table partitioning is different from database par...
1. Create a repository in the specified directory...
1. Function: xargs can convert the data separated...
Basic Use <!DOCTYPE html> <html lang=&qu...
Browser compatibility is the most important part ...
This article example shares the specific code of ...
Table of contents Preface Preliminary preparation...
The CSS counter attribute is supported by almost ...
Table of contents 1. Basic knowledge: 2. DHCP ser...
This article example shares the specific code of ...
1. Introduction As we all know, in the applicatio...
background: Because the server deployed the flask...
Recorded the download and installation tutorial o...
Prepare the ingredients as shown above (ps: hadoo...