Warning: Array to string conversion in /home/wwwroot/myf5/wp-content/plugins/wpjam-basic/public/wpjam-utils.php on line 496
How to build a sidecar nginx plus docker image
Jing Lin@2019.08.23
- Prepare the Dockerfile and the relevant SSL cert/key
-rw-r--r--. 1 root root 33 Aug 23 20:08 controller-api-key.txt
-rw-r--r--. 1 root root 2067 Aug 23 22:17 default.conf
-rw-r--r--. 1 root root 38 Aug 23 19:51 demo-index.html
-rw-r--r--. 1 root root 2939 Aug 23 22:16 Dockerfile
-rw-r--r--. 1 root root 1224 Aug 23 18:58 nginx-repo.crt
-rw-r--r--. 1 root root 1704 Aug 23 18:58 nginx-repo.key
-rw-r--r--. 1 root root 1152 Aug 23 22:20 server.crt
-rw-r--r--. 1 root root 1705 Aug 23 22:21 server.key
- The dockerfile like, this file include install controller agent as well.
- The default nginx configurations in conf.d, enable ssl and http2. Also enable nginx plus self API and dashboard.
- Build the image. Note: Make sure the host can resolve the CTRL_HOST FQDN. Add it into hosts file or using DNS server to resolve it. The below API_KEY and CTRL_HOST is just sample, pls change to real key
docker build --no-cache --build-arg \
API_KEY=eb05ff073455e4bdc5f758290f385988 \
--build-arg CTRL_HOST=ng-ctlr.lab.f5se.io \
-t myf5/nginx-plus-sidecar:slim .
- Run
docker imagesto verify the image.
[root@plus1 nginx-plus-image-build]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
myf5/nginx-plus-sidecar slim 614e06f91830 9 minutes ago 185MB
debian stretch-slim 220611111e8c 9 days ago 55.3MB
- If you want to use the image on other host, then save and load it
docker save -o nginx-plus-sidecar-img.tar myf5/nginx-plus-sidecar:slim
docker load -i nginx-plus-sidecar-img.tar
- If you want to push the image to a repo, pls only push to the private repo. Push to public repo is FORBIDDEN.
文章评论