mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +00:00
Adds detailed docker usage instructions (#1527)
* Adds detailed docker usage instructions * Fixes a couple of typos * Add link to release image description * Describe the canary tag
This commit is contained in:
committed by
Marwan Sulaiman
parent
15733395eb
commit
24f10b8a25
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: Using the Athens Docker images
|
||||
description: Information about Athens' Docker images
|
||||
weight: 1
|
||||
---
|
||||
|
||||
Whether setting Athens up using [Kubernetes](./install-on-kubernetes) or using the [Walkthrough](/Walkthrough), you'll most likely be using one of the images that the Athens project produces. This document details what images are available, and has a recap from the Walkthrough of how to use them on their own.
|
||||
|
||||
---
|
||||
|
||||
## Available Docker images
|
||||
|
||||
The Athens project produces two docker images, available via [Docker Hub](https://hub.docker.com/)
|
||||
|
||||
1. A release version as [`gomods/athens`](https://hub.docker.com/gomods/athens), each tag corresponds with an Athens [release](https://github.com/gomods/athens/releases), e.g. `v0.7.1`. Additionally, a `canary` tag is available and tracks each commit to `master`
|
||||
2. A tip version, as [`gomods/athens-dev`](https://hub.docker.com/r/gomods/athens-dev), tagged with every commit to `master`, e.g. `1573339`
|
||||
|
||||
For a detailed tags list, check each image's Docker Hub
|
||||
|
||||
## Running Athens as a Docker image
|
||||
|
||||
This is a quick recap of the [Walkthrough](/walkthrough)
|
||||
|
||||
### Using the `docker` cli
|
||||
|
||||
In order to run the Athens Proxy using docker, we need first to create a directory that will store the persitant modules.
|
||||
In the example below, the new directory is named `athens-storage` and is located in our userspace (i.e. `$HOME`).
|
||||
Then we need to set the `ATHENS_STORAGE_TYPE` and `ATHENS_DISK_STORAGE_ROOT` environment variables when we run the Docker container.
|
||||
|
||||
**Bash**
|
||||
```bash
|
||||
export ATHENS_STORAGE=$HOME/athens-storage
|
||||
mkdir -p $ATHENS_STORAGE
|
||||
docker run -d -v $ATHENS_STORAGE:/var/lib/athens \
|
||||
-e ATHENS_DISK_STORAGE_ROOT=/var/lib/athens \
|
||||
-e ATHENS_STORAGE_TYPE=disk \
|
||||
--name athens-proxy \
|
||||
--restart always \
|
||||
-p 3000:3000 \
|
||||
gomods/athens:latest
|
||||
```
|
||||
|
||||
**PowerShell**
|
||||
```PowerShell
|
||||
$env:ATHENS_STORAGE = "$(Join-Path $HOME athens-storage)"
|
||||
md -Path $env:ATHENS_STORAGE
|
||||
docker run -d -v "$($env:ATHENS_STORAGE):/var/lib/athens" `
|
||||
-e ATHENS_DISK_STORAGE_ROOT=/var/lib/athens `
|
||||
-e ATHENS_STORAGE_TYPE=disk `
|
||||
--name athens-proxy `
|
||||
--restart always `
|
||||
-p 3000:3000 `
|
||||
gomods/athens:latest
|
||||
```
|
||||
|
||||
|
||||
## Troubleshooting Athens in Docker
|
||||
|
||||
### `init` issues
|
||||
|
||||
The Athens docker image uses [tini](https://github.com/krallin/tini) so that defunct processes get reaped.
|
||||
Docker 1.13 and greater includes `tini` and lets you enable it by passing the `--init` flag to `docker run` or by configuring the docker deamon with `"init": true`. When running in this mode. you may see a warning like this:
|
||||
|
||||
```console
|
||||
[WARN tini (6)] Tini is not running as PID 1 and isn't registered as a child subreaper.
|
||||
Zombie processes will not be re-parented to Tini, so zombie reaping won't work.
|
||||
To fix the problem, use the -s option or set the environment variable TINI_SUBREAPER to register Tini as a child subreaper, or run Tini as PID 1.
|
||||
```
|
||||
This is the "Athens-tini" complaining that it's not running as PID 1.
|
||||
There is no harm in that, since the zombie processes will be reaped by the `tini` included in Docker.
|
||||
@@ -86,6 +86,9 @@ for a short period of time, as you will quickly run out of memory and the storag
|
||||
doesn't persist between restarts.
|
||||
|
||||
### With Docker
|
||||
|
||||
For more details on running Athens in docker, take a look at the [install documentation](/install/using-docker)
|
||||
|
||||
In order to run the Athens Proxy using docker, we need first to create a directory that will store the persitant modules.
|
||||
In the example below, the new directory is named `athens-storage` and is located in our userspace (i.e. `$HOME`).
|
||||
Then we need to set the `ATHENS_STORAGE_TYPE` and `ATHENS_DISK_STORAGE_ROOT` environment variables when we run the Docker container.
|
||||
@@ -116,17 +119,6 @@ docker run -d -v "$($env:ATHENS_STORAGE):/var/lib/athens" `
|
||||
gomods/athens:latest
|
||||
```
|
||||
|
||||
Athens docker image uses [tini](https://github.com/krallin/tini) so that defunct processes get reaped.
|
||||
Since Docker 1.13 and greater includes `tini` and lets you enable it by passing the `--init` flag to `docker run` or by configuring the docker deamon with `"init": true`, you may see a warning like this:
|
||||
|
||||
```console
|
||||
[WARN tini (6)] Tini is not running as PID 1 and isn't registered as a child subreaper.
|
||||
Zombie processes will not be re-parented to Tini, so zombie reaping won't work.
|
||||
To fix the problem, use the -s option or set the environment variable TINI_SUBREAPER to register Tini as a child subreaper, or run Tini as PID 1.
|
||||
```
|
||||
This is the "Athens-tini" complaining that it's not running as PID 1.
|
||||
There is no harm in that, since the zombie processes will be reaped by the `tini` included in Docker.
|
||||
|
||||
Next, you will need to enable the [Go Modules](https://github.com/golang/go/wiki/Modules)
|
||||
feature and configure Go to use the Athens proxy!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user