# Build Your Own Docker Images

You can build an APISIX image from the released Docker source and customize that source for your environment.

## Prerequisite(s)[​](#prerequisites "Direct link to Prerequisite(s)")

* Install [Git](https://git-scm.com/downloads) to download the Docker source.
* Install [Docker](https://docs.docker.com/engine/install/) to build and run the image.
* Install [Make](https://www.gnu.org/software/make/) to run the image build target.

## Clone Repository[​](#clone-repository "Direct link to Clone Repository")

Clone the release branch for this documentation version:

```
git clone --branch release/apisix-3.20.0 --depth 1 https://github.com/apache/apisix-docker.git

cd apisix-docker
```

## Build a Docker Image[​](#build-a-docker-image "Direct link to Build a Docker Image")

Build an Ubuntu image with Make:

```
make build-on-ubuntu
```

Use `make build-on-debian` or `make build-on-redhat` to build one of the other supported images.

## Check Docker Image[​](#check-docker-image "Direct link to Check Docker Image")

Confirm that the built image contains the expected APISIX release:

```
docker run --rm --entrypoint apisix \

  apache/apisix:3.20.0-ubuntu version
```

You should see the APISIX version:

```
3.20.0
```

## Preserve the Container Entry Point[​](#preserve-the-container-entry-point "Direct link to Preserve the Container Entry Point")

Keep the release image's `/docker-entrypoint.sh` entrypoint and `docker-start` command when extending the image. The entrypoint initializes APISIX and then executes OpenResty with `daemon off;`, which keeps the gateway in the foreground as the container's final process.

Do not replace the container command with `apisix start`. That command returns after OpenResty starts in daemon mode, so a container whose final process is only `apisix start` exits even though the daemon was started.
