
wsl下ubuntu更换国内源执行 lsb_release查看当前版本andrewDESKTOP-C89VHE5:~/docker_temp$ lsb_release-aNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu24.04.4 LTS Release:24.04Codename: noble添加国内源 vim /etc/apt/sources.list# 阿里云 Ubuntu 24.04 (noble) 源deb http://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse# 清华 Ubuntu 24.04 (noble) 源deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse更新源并安装基础编译组件 gcc等sudoaptupdatesudoaptupgrade-ysudoaptinstall-ygitcurlwgetbuild-essentialwsl下安装docker配置docker源wsl下执行命令脚本docker_config.sh#!/bin/bash# 极简版配置Docker阿里云镜像源sudomkdir-p/etc/docker# 替换下面的【你的阿里云镜像地址】为实际地址sudotee/etc/docker/daemon.json-EOF { registry-mirrors: [ https://docker.1ms.run ] } EOFsudoservicedockerrestartecho配置完成执行 docker run hello-world 测试验证docker源执行dockerrun hello-world获得结果andrewDESKTOP-C89VHE5:~$ docker run hello-world Unable to find image hello-world:latest locally latest: Pulling from library/hello-world 4f55086f7dd0: Pull complete d5e71e642bf5: Download complete Digest: sha256:452a468a4bf985040037cb6d5392410206e47db9bf5b7278d281f94d1c2d0931 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the hello-world image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/安装mongodb数据库缓存redis# MongoDB 6.0dockerrun-d--nameopenim-mongo-p27017:27017 mongo:6.0# Redis 7.0dockerrun-d--nameopenim-redis-p6379:6379 redis:7.0