Pipe command to docker start

  docker, entry-point

I have a docker file:

from ubuntu

I’ve build it with:

docker image build --tag my-ubuntu . 

I have a container out of that:

docker container create --interactive --tty --name my-ubuntu my-ubuntu

I can start and execute some commands: (bash is default)

docker start --interactive my-ubuntu

I can see output of commands.

Now I want to start it and pipe some commands:

echo ls && exit | docker start --interactive my-ubuntu

Problem: I don’t see ls output.

Where is the output of piped command?

Why I don’t use docker exec? I will have a few of these images with different entry points, I don’t want my caller script to be aware of entry point of each container and pass it to docker exec.

Source: Docker Questions