spicy burrito
spicy burrito

Reputation: 197

Dockerfile 'FROM' command not executing a line

I am building a Dockerfile however when I execute docker build , it returns an error:

Error response from daemon: Dockerfile parse error line 7: FROM requires either one or three arguments

My line 7 command is:

FROM nvidia-docker run -it gcr.io/tensorflow/tensorflow:latest-devel-gpu

I am a bit confused as to why this command does not work because I use this command in bash to build the docker that I require (without the FROM command obviously).

NOTE: I want to build an image of this nvidia-docker run -it gcr.io/tensorflow/tensorflow:latest-devel-gpu AND have some other stuff on top of that image which I have included in the subsequent lines of the Dockerfile.

Upvotes: 0

Views: 3083

Answers (2)

pinty
pinty

Reputation: 499

I think you are getting confused with the usage of nvidia-docker:

nvidia-docker is essentially a wrapper around the docker command that transparently provisions a container with the necessary components to execute code on the GPU. It is only absolutely necessary when using nvidia-docker run to execute a container that uses GPUs.

So what you are trying to do is run a command inside a Dockerfile.

I think that what you want to do is something like:

FROM gcr.io/tensorflow/tensorflow:latest-devel-gpu
...

As you see, the Dockerfile contains no reference to nvidia wrapper as it will be used to run the container, not to build the image.

And then build and run the image with the nvidia wrapper:

docker build -t tensorflow .
nvidia-docker run -it tensorflow

Upvotes: 2

Nanne
Nanne

Reputation: 64399

The FROM keyword is used like this:

FROM ImageName

and nvidia-docker run -it gcr.io/tensorflow/tensorflow:latest-devel-gpu is not an image name. You should find an image (name) you want to start from, and put it in there. What you have there is a command.

see the docs: https://docs.docker.com/engine/reference/builder/#from

FROM <image> [AS <name>]
Or

FROM <image>[:<tag>] [AS <name>]
Or

FROM <image>[@<digest>] [AS <name>]

Upvotes: 1

Related Questions