> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# iamanonymous419/docker

A reusable CircleCI orb that helps simplify Docker operations like building, tagging, and pushing.


## Commands

### build

Build a Docker image

| Parameter | Type | Default | Description |
|---|---|---|---|
| `build-args` | string |  | Optional build arguments (space-separated, e.g., "NODE_ENV=production API_URL=https://api.example.com")
 |
| `build-context` | string | . | Build context path (e.g., ./client) |
| `dockerfile-path` | string | Dockerfile | Path to Dockerfile (e.g., ./client/Dockerfile) |
| `image-name` | string |  | Name of the Docker image (e.g., youruser/chat-client) |
| `tag` | string | latest | Tag of the image (e.g., latest, build-123) |

### login

Docker login to Docker Hub using provided credentials.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `password` | env_var_name |  | Environment variable that holds your Docker Hub password |
| `username` | string |  | Docker Hub username |

### push

Push a Docker image to Docker Hub with the given name and tag.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `image-name` | string |  | Name of the Docker image (e.g., yourusername/client) |
| `tag` | string | latest | Tag to push (e.g., latest, v1.0.0) |

### tag

Tag a Docker image with a new tag.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `image-name` | string |  | Name of the Docker image (e.g., yourusername/client) |
| `new-tag` | string |  | New tag to apply (e.g., latest) |
| `old-tag` | string |  | Existing tag to tag from (e.g., build-123) |

## Examples

### example

Example workflow using the docker-tools orb's commands to build, tag, login, and push a Docker image to Docker Hub.


```yaml
version: '2.1'
orbs:
  docker: iamanonymous419/docker@5.0.0
jobs:
  full-docker-pipeline:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      - docker/build:
          build-args: NODE_ENV=production API_URL=https://api.example.com
          build-context: ./client
          dockerfile-path: ./client/Dockerfile
          image-name: yourdockerhubuser/client
          tag: build-123
      - docker/login:
          password: DOCKERHUB_PASSWORD
          username: yourdockerhubuser
      - docker/tag:
          image-name: yourdockerhubuser/chat-client
          new-tag: latest
          old-tag: build-123
      - docker/push:
          image-name: yourdockerhubuser/client
          tag: latest
workflows:
  use-my-orb:
    jobs:
      - full-docker-pipeline
```