mysql、redis、rabbitmqversion: '3.8' services: mysql: image: mysql:8.0.33 container_name: common-mysql8 environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: my ports: - "3306:3306" volumes: - mysql_data:/var/lib/mysql #platform: linux/arm64 platform: linux/amd64 restart: always redis: image: redis:6.2.12 container_name: common-redis6 ports: - "6379:6379" volumes: - redis_data:/data environment: TZ: Asia/Shanghai #command: ["redis-server", "--requirepass", "yourpassword"] # 直接在启动命令中写死密码 #platform: linux/arm64 platform: linux/amd64 restart: always rabbitmq: image: rabbitmq:management container_name: rabbitmq-container environment: - RABBITMQ_DEFAULT_USER=YOURUSERNAME - RABBITMQ_DEFAULT_PASS=YOURPASSWORD ports: - "5672:5672" # AMQP 端口 - "15672:15672" # RabbitMQ 管理界面端口 volumes: mysql_data: redis_data: minioservices: minio: image: minio/minio:RELEASE.2022-01-04T07-41-07Z container_name: minio environment: MINIO_ROOT_USER: "admin" # 管理员用户名 MINIO_ROOT_PASSWORD: "123456" # 管理员密码 ports: - "9001:9000" # MinIO API 端口 - "9002:9001" # MinIO 控制台端口 volumes: - ./minio_data:/data # 持久化存储 command: server /data --console-address ":9001" restart: unless-stoppednsqservices: nsqlookupd: image: nsqio/nsq:v1.3.0 command: /nsqlookupd ports: - "4160:4160" # TCP 端口，供 nsqd 注册 - "4161:4161" # HTTP 端口，供 nsqadmin 和客户端查询 networks: - nsq-network nsqd: image: nsqio/nsq:v1.3.0 command: /nsqd --lookupd-tcp-address=nsqlookupd:4160 --broadcast-address=nsqd # 改为容器名或确保IP正确 depends_on: - nsqlookupd ports: - "4150:4150" # TCP 端口，供生产者连接 - "4151:4151" # HTTP 端口，供管理操作 networks: - nsq-network nsqadmin: image: nsqio/nsq:v1.3.0 command: /nsqadmin --lookupd-http-address=nsqlookupd:4161 depends_on: - nsqlookupd ports: - "4171:4171" # Web 管理界面 networks: - nsq-network networks: nsq-network: driver: bridge
运行私有注册表容器：docker run -d -p 5000:5000 --name registry registry:2将镜像推送到私有注册表：docker tag <your-image> localhost:5000/<your-image> docker push localhost:5000/<your-image>从私有注册表中拉取镜像：docker pull localhost:5000/这种方式可以减少反复从 Docker Hub 下载镜像的次数，提高效率。注意事项如果需要外网或者局域网访问，需要加白，里面的ip是你对应的外网ip或者局域网ipsudo nano /etc/docker/daemon.json{ "insecure-registries" : ["192.168.4.103:5000"] }sudo systemctl restart docker