Table of Contents

About

This page is about the main entry in Docker.

The entry point script is the script called when creating a container from an image with the docker run command

When the entry point program exits, the VM is stopped (killed). A process needs to run in the foreground.

Example

Default

When you run docker like this:

docker run -i -t ubuntu bash 

Wrapper entrypoint.sh

The below script start a process before starting the command given at the command line.

It's a wrapper around the default entrypoint.

If you set the entrypoint in your dockerfile, you need to set it with the exec form otherwise you get no arguments.

#!/usr/bin/env bash

echo Starting the ssh-agent for convenience
eval `ssh-agent`

# Start the passed command ($*)
/bin/sh -c "$*"

Management

Assignement

Console

docker run --entrypoint /script.sh repo/image

where: How to run a docker image with example to create a container?

Default (dockerfile)

The default entrypoint is defined by the ENTRYPOINT instruction.

List

docker inspect --format "{{range .Config.Entrypoint}}{{.}}{{end}}" (containerName|imageName)

Example on the image org/ubuntu:latest

docker inspect --format "{{range .Config.Entrypoint}}{{.}}{{end}}" org/ubuntu:latest

See Docker - Inspect

Multiple processes

How to start multiple processes in Docker?