capabilities.work

Pull an Image and Run a Container

A 5-step recipe with Docker. We can help you get access.

Recipe · 5 steps

Pull an Image and Run a Container

with Docker

Pull an image, create and start a container from it, and confirm it is running.

  1. Pull the requested image and tag from the registry into the daemon's local image store so the container can be created from it.
  2. Confirm the pulled image is present in the local store and capture its id before creating a container from it.
  3. Create a container from the pulled image with the supplied name, command and environment. The container is created but not yet started.
  4. Start the newly created container. The daemon returns 204 on success and 304 if the container was already started.
  5. Read back the container's low-level state to confirm the daemon reports it running, and capture the state and network settings for the caller.
What you'll need to have ready
  • image: Name of the image to pull (e.g. "nginx" or "registry.example.com/myimage").
  • tag: Tag of the image to pull and run (e.g. "alpine" or "latest").
  • containerName: Name to assign to the created container.
  • cmd: Command to run in the container, as an argv array.
  • env: Environment variables in "KEY=value" form.
  • registryAuth: Base64url-encoded registry auth configuration, required only for private images.
For your developer

Arazzo workflow docker:run-container, 5 operations: ImageCreate → ImageInspect → ContainerCreate → ContainerStart → ContainerInspect. Specs on APIs.io.