# Docker

[Docker Hub](https://hub.docker.com/r/aux4/aux4)

The Docker image [aux4/aux4](https://hub.docker.com/r/aux4/aux4) is based on [Ubuntu](https://ubuntu.com), and it contains [pkgx](https://pkgx.sh) installed.

```bash
> docker run --rm -v <ABSOLUTE PATH TO YOUR .aux4 FILE>:/home/aux4/.aux4 -it aux4/aux4 <ARGS>
```

You have to create a volume to your `.aux4` file, otherwise it won't have your custom commands.

The container will be removed after the execution. If you want to keep it, feel free to remove the `--rm` parameter.

## Example

Create your `.aux4` file.

```json
{
  "profiles": [
    {
      "name": "main",
      "commands": [
        {
          "name": "hello",
          "execute": [
            "echo Hello ${name}"
          ],
          "help": {
            "text": "say hello",
            "variables": [
              {
                "name": "name",
                "text": "the name to say hello"
              }
            ]
          }
        }
      ]
    }
  ]
}
```

Run it on Docker:

```bash
> docker run --rm -v $(pwd)/.aux4:/home/aux4/.aux4 -it aux4/aux4 hello --name "John Doe"
```

```text
Hello John Doe
```

## aux4/docker Package

An easier option is to use the [aux4/docker](https://hub.aux4.io/r/public/packages/aux4/docker) package, which wraps the raw `docker run` invocation above into a plain aux4 command:

```bash
> aux4 aux4 pkger install aux4/docker
```

```bash
> aux4 aux4 docker run hello --name "John Doe"
```

```text
Hello John Doe
```

It mounts the current directory by default, so no manual volume flags are needed — pass `--hostVolume`/`--volume` to change that, or `--image` to run against a different image than `aux4/aux4`.

`aux4 aux4 docker test <command>` follows the same pattern, running against the [`aux4/test`](/testing) image instead of `aux4/aux4` — useful for running a `.test.md` suite in an isolated container.

Building your own aux4-based Docker image (bundling a package as a standalone container) is available through `aux4 aux4 docker build` — see `aux4 aux4 docker build --help` for the available options.

---

## See Also

- [Variables](/variables)
- [Executors](/executors)
- [Functions](/functions)
- [Config](/config)
- [Commands](/commands)
- [Hooks](/hooks)
- [Render](/render)
- [Testing](/testing)
- [Package Manager](/package-manager)
- [Packaging](/packaging)
