This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/docs/reference/docker/README.md
Andrea Luzzardi 50d55a8885 op.#SaveImage: export the image ID
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-10-12 15:39:04 -07:00

108 lines
4.0 KiB
Markdown

---
sidebar_label: docker
---
# alpha.dagger.io/docker
Docker container operations
```cue
import "alpha.dagger.io/docker"
```
## docker.#Build
Build a Docker image from source
### docker.#Build Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*source* | `dagger.#Artifact` |Build context |
|*dockerfile* | `*null \| string` |Dockerfile passed as a string |
### docker.#Build Outputs
_No output._
## docker.#Command
A container image that can run any docker command
### docker.#Command Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*command* | `string` |Command to execute |
|*registries* | `[]` |Image registries |
### docker.#Command Outputs
_No output._
## docker.#Load
Load a docker image into a docker engine
### docker.#Load Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*tag* | `string` |Name and optionally a tag in the 'name:tag' format |
|*source* | `dagger.#Artifact` |Image source |
|*load.command* | `"docker load -i /src/image.tar"` |Command to execute |
|*load.registries* | `[]` |Image registries |
### docker.#Load Outputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*id* | `string` |Image ID |
## docker.#Pull
Pull a docker container
### docker.#Pull Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*from* | `string` |Remote ref (example: "index.docker.io/alpine:latest") |
### docker.#Pull Outputs
_No output._
## docker.#Push
Push a docker image to a remote registry
### docker.#Push Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*target* | `string` |Remote target (example: "index.docker.io/alpine:latest") |
|*source* | `dagger.#Artifact` |Image source |
### docker.#Push Outputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*ref* | `string` |Image ref |
|*digest* | `string` |Image digest |
## docker.#Run
### docker.#Run Inputs
| Name | Type | Description |
| ------------- |:-------------: |:-------------: |
|*ref* | `string` |Image reference (e.g: nginx:alpine) |
|*run.command* | `"""\n # Run detach container\n OPTS=""\n \n if [ ! -z "$CONTAINER_NAME" ]; then\n \tOPTS="$OPTS --name $CONTAINER_NAME"\n fi\n \n if [ ! -z "$CONTAINER_PORTS" ]; then\n \tOPTS="$OPTS -p $CONTAINER_PORTS"\n fi\n \n docker container run -d $OPTS "$IMAGE_REF"\n """` |Command to execute |
|*run.env.IMAGE_REF* | `string` |- |
|*run.registries* | `[]` |Image registries |
### docker.#Run Outputs
_No output._