Understand ENTRYPOINT

Hi, I followed the [example] to publish an ASP.NET Application to docker container.(http://www.hanselman.com/blog/PublishingAnASPNET5AppToDockerOnLinuxWithVisualStudio.aspx).

In the DockerFile, we have one line.
ENTRYPOINT ["./web"]

I just don’t understand it. What does it mean ./web? Can we change it to a different name such as "./webTest"?

The ./web file in the working directory will be executed when the container is invoked with docker run.

You could change the name to ./webTest if you like but you need to ensure that whatever build artifact that is (binary etc.) gets emitted with that name.

If you follow http://www.hanselman.com/blog/PublishingAnASPNET5AppToDockerOnLinuxWithVisualStudio.aspx I publish the application to a Linux Server. But there is no such file “web” exist on Windows side. If you meant on Linux side, what is the full path then? I still can’t get it.

Yeah, the ./web file mentioned is in Linux: In the container you are running, on the Linux server.

Impossible to say without seeing the full Dockerfile. All Docker builds start with their working directory as /, and it remains that way unless set using WORKDIR.

The DockerFile is:
FROM microsoft/aspnet:1.0.0-rc1-update1
ADD . /app
WORKDIR /app/approot
ENTRYPOINT ["./web"]

And the remote file structure likes the image below.

I’m not sure what the directory you’re showing is, but it doesn’t seem to be the directory which ends up getting run in the final container image, since it indicates quite clearly in the Dockerfile that the final invoked executable is located at /app/approot/web relative to the build context.

So what is the directory of the final container image? I assume it is
/var/lib/docker
I found web file at AppData\Local\Temp\PublishTem.
The script is:

#!/usr/bin/env bash

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

exec “dnx” --project “$DIR/src/HelloDocker” --configuration Release web "$@"
I just can’t find web file on Linux side. But I can see the image name in this folder…

Kind of, but /var/lib/docker is an internal Docker directory that is usually not meant to be interacted with directly.

Why do you need to find the web file? It’s in the container at /app/approot/web, ready to be invoked when you run the container. If you really want to poke at it, just run the container:

$ docker run -ti --entrypoint bash user/image