2

I want to create and run a Docker container for my Angular 4 application.

I ve created the image :

docker build -t front:Angular4 -f src/main/docker/Dockerfile .

and i tried to create anbd run the container instance of my image using :

docker run --name frontcontainer -it front:Angular4 -p 4200:4300 -v /usr/share/nginx/logs:/usr/share/nginx/logs -P

this seems creating the container but not running it . And it throws this error:

Error response from daemon: Cannot start container 40613e12e254a433e2b5f774ffcab67be9c3027cef761141f63ec8fb03bfc108: [8] System error: exec: "-p": executable file not found in $PATH

Suggestions ?

1
  • did you resolve this ? Commented Oct 19, 2017 at 17:33

2 Answers 2

2

Try like this :

Step 1 :

You need to create docker file inside the project root.

- myApp/
    - Dockerfile

inside the Docker file add below code

FROM nginx:alpine
COPY dist /usr/share/nginx/html

Step 2:

build your project in production mode

Step 3 :

docker login

docker build -t <your registry or image location> .

docker run --name <your project name > -d -p 4200:81 <your registry or image location>

docker push <your registry or image location>
Sign up to request clarification or add additional context in comments.

Comments

1

The error message is, I believe, telling you that you need to fix the syntax on your command.

The syntax (docker run --help) shows the syntax should be something like:

docker run [OPTIONS] IMAGE [COMMAND]

So, something like below might be closer to what you're looking for:

docker run 
  -itP \
  --name frontcontainer \
  -p 4200:4300 \
  -v /usr/share/nginx/logs:/usr/share/nginx/logs \
  front:Angular4

Unrelated, but your first command isn't building the image. It's also a malformed docker run command and will probably also present an error.

1 Comment

Our Markdown engine is not GitHub-flavored. Triple-quotes are not special here; use four-space indents for multi-line code blocks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.