我有以下的
docker-compose
文件
version: '3'
services:
node1:
build: node1
container_name: node1
node2:
build: node2
container_name: node2
这是node1的dockerfile
FROM ubuntu
RUN apt-get update && apt-get install -y iputils-ping
COPY true.sh /var/
CMD ["/var/true.sh"]
node2 dockerfile扩展node1如下
FROM node1
RUN apt-get update && apt-get install -y iputils-ping
COPY true.sh /var/
CMD ["/var/true.sh"]
现在当我用
docker-compose up -d --build
,初始为空的本地映像存储库中,出现以下错误
ERROR: Service 'node2' failed to build: pull access denied for node1, repository does not exist or may require 'docker login'
使用compose构建图像时,如何定义标记?目前,以下图片已生成
REPOSITORY TAG IMAGE ID CREATED SIZE
docker_node1 latest 52dd5a083162 7 minutes ago 123MB
ubuntu latest 113a43faa138 19 hours ago 81.2MB
我知道我可以用vanilla docker来构建映像,但是我喜欢这样的想法:让一个新手用一个命令引导一个新的环境,并让同一个命令在对其构建进行更改时重新启动更改的容器。