Docker icon

Docker

Manage Docker containers, images, networks, volumes, and daemon metadata with Unix socket, TCP, TLS, or SSH connections

Container → Create

AI-generated

Summary

Create a Docker container with specified configuration.

Inputs

  • createName — Optional container name
  • createImage (required) — Docker image reference (e.g., alpine:latest)
  • createCommandArgs — Command arguments to override container entrypoint
  • createEnv — Environment variables to set inside the container
  • createLabels — Key-value labels attached to the container
  • createWorkingDir — Working directory for the container
  • createUser — User under which the container runs
  • createTty — Allocate a TTY for the container
  • createOpenStdin — Keep STDIN open even if not attached
  • createRestartPolicyName — Restart policy (e.g., always, on-failure)
  • createRestartPolicyMaximumRetryCount — Maximum retries for on-failure restart policy
  • createAutoRemove — Automatically remove the container when it exits
  • createNetworkMode — Network mode (e.g., bridge, host)
  • createBindMounts — Bind mount specifications (source:target:readOnly)
  • createPortBindings — Port mapping specifications (containerPort:hostPort:protocol)
  • createVolumeMounts — Named volume mount specifications (volumeName:target:readOnly)
  • createAdvancedJson — Arbitrary JSON to merge into the create payload, overriding structured fields

Output shape

a single container resource object

Returns the created container's metadata (e.g., id, name, status); may include additional Docker fields.

Examples

Example 1: Run a simple Alpine container named my-app

createName: my-app, createImage: alpine:latest, createAutoRemove: true

Example 2: Start a web server container with port mapping and environment variables

createImage: nginx:latest, createPortBindings: [{"containerPort":80,"hostPort":8080,"protocol":"tcp"}], createEnv: [{"name":"PORT","value":"80"}]

Example 3: Create a container with a bind mount for persistent storage

createImage: redis:alpine, createBindMounts: [{"source":"/host/data","target":"/data","readOnly":false}]

Links

Discussion