I'm trying to enter interactive mode using an official Microsoft .Net Core image and use typical .Net commands such as 'dotnet build', but all I get is an '>' cursor. What am I doing wrong?
I'm using the following command:
docker run -it -v $(pwd):/app' -w '/app' -p 8000:80 mcr.microsoft.com/dotnet/core/sdk /bin/bash
I was hoping to get a root command prompt, but all I'm getting is '>'
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Run a command in a running container
Options:
-d, --detach Detached mode: run command in the background
--detach-keys string Override the key sequence for detaching a
container
-e, --env list Set environment variables
-i, --interactive Keep STDIN open even if not attached
--privileged Give extended privileges to the command
-t, --tty Allocate a pseudo-TTY
-u, --user string Username or UID (format:
<name|uid>[:<group|gid>])
-w, --workdir string Working directory inside the container
After running your container, run command docker ps to take [Container ID]
And after you are able to run the command like there docker exec -it [Container ID] bash .
You are misssing the initial quote here:
-v $(pwd):/app'
That should be:
-v "$(pwd):/app"
It needs to be a double-quote for $(pwd) to be evaluated correctly by the shell. Otherwise the shell will send the literal $(pwd) which is not a valid path.
It seems no one gives a direct answer, this one works for me:
docker run --rm -it -v $PWD:/app -w /app -p 8000:80 mcr.microsoft.com/dotnet/core/sdk /bin/bash