Skip to content

Commit

Permalink
Add documentation for docker images (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley authored Aug 4, 2023
1 parent 0f149a8 commit 8888428
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 12 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ NGINX Agent is a companion daemon for your NGINX Open Source or NGINX Plus insta
- [Installing NGINX Agent from Package Files](#installing-nginx-agent-from-package-files)
- [Starting and Enabling Start on Boot](#starting-and-enabling-start-on-boot)
- [Logging](#logging)
- [Building Docker Image](#building-docker-image)
- [Getting Started with NGINX Agent](#getting-started-with-nginx-agent)
- [Installing NGINX](#installing-nginx)
- [Cloning the NGINX Agent Repository](#cloning-the-nginx-agent-repository)
Expand Down Expand Up @@ -150,6 +151,14 @@ If you need to make changes to the default configuration you can update the file

For more detail on logrotate configuration see [Logrotate Configuration Options](https://linux.die.net/man/8/logrotate)

## Building Docker Image
To build an image that contains the latest NGINX Agent and the latest mainline version of NGINX OSS run the following command:
```
make official-oss-image
```

For more information on how to run NGINX Agent containers and how build an image that uses NGINX Plus instead of NGINX OSS see [Docker Images](https://docs.nginx.com/nginx-agent/docker-images/)

# Getting Started with NGINX Agent
Follow these steps to configure and run NGINX Agent and a mock interface ("control plane") to which the NGINX Agent will report.

Expand Down
2 changes: 1 addition & 1 deletion hugo/content/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Changelog"
draft: false
description: "NGINX Agent updates changelog."
weight: 1100
weight: 1200
toc: true
tags: [ "docs" ]
docs: "DOCS-1093"
Expand Down
2 changes: 1 addition & 1 deletion hugo/content/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Contributing and Support"
draft: false
description: "Learn about the NGINX Agent community."
weight: 900
weight: 1000
toc: true
tags: [ "docs" ]
docs: "DOCS-1087"
Expand Down
4 changes: 2 additions & 2 deletions hugo/content/configuration-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Configuration Overview"
draft: false
description: "Learn the overview of configuration"
weight: 500
weight: 800
toc: true
tags: [ "docs" ]
docs: "DOCS-1229"
Expand Down Expand Up @@ -268,4 +268,4 @@ By default, NGINX Agent rotates logs daily using logrotate with the following co

If you need to make changes to the default configuration you can update the file here `/etc/logrotate.d/nginx-agent`

For more detail on logrotate configuration see [Logrotate Configuration Options](https://linux.die.net/man/8/logrotate)
For more detail on logrotate configuration see [Logrotate Configuration Options](https://linux.die.net/man/8/logrotate)
2 changes: 1 addition & 1 deletion hugo/content/dev-environment-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Development Environment Setup"
draft: false
description: "Learn how to setup a Development Environment for NGINX Agent."
weight: 800
weight: 900
toc: true
tags: [ "docs" ]
docs: "DOCS-1088"
Expand Down
70 changes: 70 additions & 0 deletions hugo/content/docker-images.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: "Docker Images"
draft: false
description: "Learn how to build and run NGINX Agent docker images"
weight: 800
toc: true
tags: [ "docs" ]
categories: ["configuration"]
doctypes: ["task"]
---

## Prerequisites
1. Docker must be [installed and running](https://docs.docker.com/engine/install/)
1. (Optional) If you plan to use NGINX Plus, you will need the nginx-repo.crt and nginx-repo.key files. You can download them from [MyF5](https://my.f5.com).

## Building NGINX Agent image with NGINX Open Source

To build an image that contains the latest NGINX Agent and the latest mainline version of NGINX run the following command:

```shell
$ cd scripts/docker/official/nginx-oss-with-nginx-agent/alpine/
$ docker build -t nginx-agent . --no-cache -f ./Dockerfile.mainline
```

To build an image that contains the latest NGINX Agent and the latest stable version of NGINX run the following command:
```shell
$ cd scripts/docker/official/nginx-oss-with-nginx-agent/alpine/
$ docker build -t nginx-agent . --no-cache -f ./Dockerfile.stable
```

## Building NGINX Agent image with NGINX Plus

1. Log in to [MyF5 Customer Portal](https://account.f5.com/myf5) and download your `nginx-repo.crt` and `nginx-repo.key` files. These files are also provided with the NGINX Plus trial package.

1. Copy the files to the directory where the Dockerfile is located `scripts/docker/official/nginx-plus-with-nginx-agent/alpine/`.

1. To build an image that contains the latest NGINX Agent and the latest version of NGINX Plus run the following command:

```shell
$ cd scripts/docker/official/nginx-plus-with-nginx-agent/alpine/
$ docker build -t nginx-agent . \
--no-cache -f ./Dockerfile \
--secret id=nginx-crt,src=nginx-repo.crt \
--secret id=nginx-key,src=nginx-repo.key
```

## Running NGINX Agent container

Here is an example of how to run a NGINX Agent container:

```console
$ docker run --name nginx-agent -d nginx-agent
```

By default, the NGINX Agent REST API is not enabled. To enable the API, the NGINX Agent configuration file `nginx-agent.conf` needs to be updated to include the API configuration, for example:

```yaml
api:
host: 0.0.0.0
port: 8038
```
Once the `nginx-agent.conf` file is updated with the API setting, following the previous example, you can run the container with the updated `nginx-agent.conf` mounted and the port `8038` exposed with the following command:

```console
$ docker run --name nginx-agent -d \
--mount type=bind,source="$(pwd)"/nginx-agent.conf,target=/etc/nginx-agent/nginx-agent.conf,readonly \
-p 127.0.0.1:8038:8038/tcp \
nginx-agent
```
2 changes: 1 addition & 1 deletion hugo/content/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Getting Started"
draft: false
description: "Learn how to configure and run NGINX Agent."
weight: 700
weight: 200
toc: true
tags: [ "docs" ]
docs: "DOCS-1089"
Expand Down
2 changes: 1 addition & 1 deletion hugo/content/installation-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Installation from GitHub Release"
draft: false
description: "Learn how to install NGINX Agent from a GitHub Release."
weight: 200
weight: 300
toc: true
tags: [ "docs" ]
docs: "DOCS-1090"
Expand Down
2 changes: 1 addition & 1 deletion hugo/content/installation-oss.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Installation From NGINX Repository"
draft: false
description: "Learn how to install NGINX Agent from OSS Repository."
weight: 300
weight: 400
toc: true
tags: [ "docs" ]
docs: "DOCS-1216"
Expand Down
2 changes: 1 addition & 1 deletion hugo/content/installation-plus.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Installation from NGINX Plus Repository"
draft: false
description: "Learn how to install NGINX Agent from NGINX Plus repository."
weight: 400
weight: 500
toc: true
tags: [ "docs" ]
docs: "DOCS-1217"
Expand Down
2 changes: 1 addition & 1 deletion hugo/content/technical-specifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Technical Specifications"
draft: false
description: "This document describes the requirements for NGINX Agent."
weight: 1000
weight: 1100
toc: true
tags: [ "docs" ]
docs: "DOCS-1092"
Expand Down
4 changes: 2 additions & 2 deletions hugo/content/uninstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Uninstall NGINX Agent Package"
draft: false
description: "Learn how to uninstall NGINX Agent"
weight: 500
weight: 700
toc: true
tags: [ "docs" ]
docs: "DOCS-1230"
Expand Down Expand Up @@ -141,4 +141,4 @@ Complete the following steps on each host where you've installed the NGINX Agent

```bash
sudo pkg delete nginx-agent
```
```

0 comments on commit 8888428

Please sign in to comment.