镜像加速

:::success window 11 docker desktop 镜像加速设置 :::

  1. {
  2. "builder": {
  3. "gc": {
  4. "defaultKeepStorage": "20GB",
  5. "enabled": true
  6. }
  7. },
  8. "experimental": false,
  9. "features": {
  10. "buildkit": true
  11. },
  12. "registry-mirrors": ["https://kzueud5d.mirror.aliyuncs.com"]
  13. }

镜像构建

Build a Dockerfile to create an image using Nginx to share your content with others. You can use a Dockerfile to generate a new image that includes the necessary content.

  1. Create a file and name it Dockerfile in your local directoryAdd the contents of the file:
  1. FROM nginx COPY your-local-html-directory /usr/share/nginx/html

OPTIONAL: To add a custom nginx configuration file, add this line:

  1. COPY nginx.conf /etc/nginx/nginx.conf
  1. Build this Dockerfile into an image using your terminal:
    1. docker build -t myimage .
    3.Run this image locally using the Images tab. Remember to add port 8080 so you can access the content.Or you can start it via the terminal:
    1. docker run --name some-nginx -d -p 8080:49153 myimage
    You can then view it in your http://localhost:8080 browser.
    For more information, see the nginx documentation and the nginx blog post.