Set Container To Run A Bash Command On Start

Create Docker Container With Entrypoint And Default Command

Create a Docker container (docker container create) called application (--name application) built of the ubuntu:latest image. Upon starting the container launches bash (--entrypoint "/bin/bash") and runs -c "echo 'hello world'".

docker container create --name application --entrypoint "/bin/bash" ubuntu:latest -c "echo 'hello world'"

Create New Image

Create a new image (docker container commit) from the application container called new-application. Add author info (-a "Chris Albon") and a commit message (-m "Added analysis file").

docker container commit -a "Chris Albon" -m "Added entrypoint and command" application new-application

Run New Image

Run the docker container (docker container run) called new-application.

docker container run new-application
hello world