基于Ubuntu14.04/CUDA8.0的Dockerfile构建镜像报错Invalid Reference Format求助
Looks like the issue is that your Dockerfile uses an ARG variable IMAGE_NAME but you're not providing a value for it when running docker build, which leads to an invalid image reference in the FROM line.
Why this happens
Your Dockerfile starts with:
ARG IMAGE_NAME FROM ${IMAGE_NAME}:8.0-devel-ubuntu14.04
When you run docker build without passing a value for IMAGE_NAME, Docker substitutes it with an empty string. That turns your FROM line into FROM :8.0-devel-ubuntu14.04—which is clearly an invalid image reference, hence the error.
Solution 1: Pass the argument during build
You need to use the --build-arg flag to specify the base image name (I assume you're using the official NVIDIA CUDA image here). Run your build command like this:
docker build --build-arg IMAGE_NAME=nvidia/cuda -t your-custom-image /home/anil/Desktop/container
Replace your-custom-image with whatever name you want to give your built image.
Solution 2: Set a default value for the ARG in Dockerfile
If you don't want to pass the argument every time, you can set a default value directly in your Dockerfile:
ARG IMAGE_NAME=nvidia/cuda FROM ${IMAGE_NAME}:8.0-devel-ubuntu14.04 # Rest of your Dockerfile steps...
Now you can run the original docker build /home/anil/Desktop/container command without extra flags, and Docker will use nvidia/cuda as the base image name by default.
Just double-check that the base image nvidia/cuda:8.0-devel-ubuntu14.04 exists (it should, as it's an official NVIDIA image) and your Docker daemon can pull it if it's not already cached locally.
内容的提问来源于stack exchange,提问作者Rachna Pathak

