Anatomy of docker run

As explained in Docker API, docker run command comprises of several API calls. Also seen in run.go, first the image is pulled if it is not locally available, then create container, attach to the container (if not detached), start the container, and wait.

So it is possible to simulate docker run with a combination of docker create, docker start, and docker logs:

#docker logs $(docker start $(docker create centos bash -c "date > /dev/null"))

This could help write a docker run using Docker API in Go


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s