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
The browser displays TIF format images Copy code T...
Implementation Preparation # Need to back up the ...
Without further ado, let’s run the screenshot dir...
Log in docker login Complete the registration and...
Mysqldump is used for logical backup in MySQL. Al...
1.What is margin? Margin is used to control the sp...
When installing a virtual machine, a prompt appea...
For several reasons (including curiosity), I star...
Table of contents Audio transcoding tools princip...
There are obvious differences between volume moun...
1. Time difference functions (TIMESTAMPDIFF, DATE...
MySql index detailed introduction and correct use...
lsof (list open files) is a tool to view files op...
The specific upgrade script is as follows: Dynami...
1. AIDE AIDE (Advanced Intrusion Detection Enviro...