Sebastian Karlsson
Sebastian Karlsson

Reputation: 745

Cant start with custom docker image on Macos

So I have this Dockerfile:

FROM nginx:alpine

COPY default.conf /etc/nginx/conf.d/
COPY index.html /usr/share/nginx/html/

I build it using: docker build .

I get the ID: 0154623d6179

And then I run:

docker run 0154623d6179 -d -p 80:80

and I get the error: docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"-d\": executable file not found in $PATH": unknown.

What am I doing wrong?

Upvotes: 1

Views: 397

Answers (2)

Robert
Robert

Reputation: 36823

Order in the params matters:

docker -d -p 80:80 run 0154623d6179

Whatever comes after image will be considered part of the command to start the container process.

Upvotes: 2

Sebastian Karlsson
Sebastian Karlsson

Reputation: 745

Solved it by putting the image ID at the end of the command

Upvotes: 0

Related Questions