Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我一直在挖掘文档,但没有找到在Dockerfile. 不过,有一个可用于命令行。
Dockerfile
假设我创建一个图像FROM另一个图像,我不希望它具有相同的名称。我应该如何进行?
FROM
不幸的是,这是不可能的。您可以使用build.sh脚本,其中包含如下:
build.sh
#!/usr/bin/env bash if [ $# -eq 0 ] then tag='latest' else tag=$1 fi docker build -t project:$tag .
运行./build.sh创建镜像project:latest或运行./build.sh your_tag指定镜像标签。
./build.sh
project:latest
./build.sh your_tag