Skip to content

Commit

Permalink
docs(cli): Clarify CLI-in-docker instructions (immich-app#1395)
Browse files Browse the repository at this point in the history
* docs(cli): Clarify CLI-in-docker instructions

* docs(cli): Add more example commands

* docs(cli): Add port to example command

* docs(cli): Really fix the server port this time
  • Loading branch information
bo0tzz authored Jan 23, 2023
1 parent cc74985 commit 9987e3b
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions docs/docs/features/bulk-upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,36 @@ The API key can be obtained in the user setting panel on the web interface.

### Run via Docker

Be aware that as this runs inside a container it mounts your current directory as a volume, and for the -d flag you need to use the path inside the container.
You can run the CLI inside of a docker container to avoid needing to install anything.

```bash
docker run -it --rm -v $(pwd):/import ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api -d /import
:::caution Running inside Docker
Be aware that as this runs inside a container, you need to mount the folder from which you want to import into the container.
:::

```bash title="Upload current directory"
cd /DIRECTORY/WITH/IMAGES
docker run -it --rm -v $(pwd):/import ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api
```

Optionally, you can create an alias:
```bash title="Upload target directory"
docker run -it --rm -v /DIRECTORY/WITH/IMAGES:/import ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api
```

```bash
```bash title="Create an alias"
alias immich="docker run -it --rm -v $(pwd):/import ghcr.io/immich-app/immich-cli:latest"
immich upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api -d /import
immich upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api
```

:::tip Internal networking
If you are running the CLI container on the same machine as your Immich server, you may not be able to reach the external address. In that case, try the following steps:
1. Find the internal Docker network used by Immich via `docker network ls`.
2. Adapt the above command to pass the `--network <immich_network>` argument to `docker run`, substituting `<immich_network>` with the result from step 1.
3. Use `--server http://immich-server:3001/` for the upload command instead of the external address.

```bash title="Upload to internal address"
docker run --network immich_default -it --rm -v $(pwd):/import ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://immich-server:3001/
```
:::

### Run from source

Expand Down

0 comments on commit 9987e3b

Please sign in to comment.