docker info
:
Client: Docker Engine - Community
Version: 24.0.7
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.11.2
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.21.0
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 15
Running: 1
Paused: 0
Stopped: 14
Images: 339
Server Version: 24.0.7
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3dd1e886e55dd695541fdcd67420c2888645a495
runc version: v1.1.10-0-g18a0cb0
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
Kernel Version: 5.4.0-132-generic
Operating System: Ubuntu 20.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 3.839GiB
Name: ubuntu-2004-clean-01
ID: e397e021-a07f-4d31-8542-a4a52e25c357
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
172.16.11.200:5000
cache.localdomain:5000
repo.localdomain:5000
127.0.0.0/8
Live Restore Enabled: false
部分Dockerfile
:
ARG DOCKER_REGISTRY_ADDRESS="cache.localdomain:5000"
ARG DISTRO=alpine
ARG DISTRO_VERSION=3.18
ARG DOCKER_NODEJS_IMAGE_NAME=${DOCKER_REGISTRY_ADDRESS}/node-${DISTRO}${DISTRO_VERSION}
FROM ${DOCKER_NODEJS_IMAGE_NAME} AS nodejs
我执行docker build . --tag image-custom
并得到:
ERROR: failed to solve: base name (${DOCKER_NODEJS_IMAGE_NAME}) should not be blank
在不同的网络上,我计划使用 docker 镜像的不同注册表地址和 docker 镜像本身的不同名称。这就是我写作的原因ARG
,以便我能做到docker build --build-arg
。