docker镜像部署
pull and run
docker pull apache/apisix
docker run --name docker_apisix -it apache/apisix /bin/bash
安装etcd并启动
wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
tar -xvf etcd-v3.4.13-linux-amd64.tar.gz
rm -rf etcd-v3.4.13-linux-amd64.tar.gz
cd etcd-v3.4.13-linux-amd64 && cp -a etcd etcdctl /usr/bin/
nohup etcd &
启动apisix
在当前工作空间下
apisix init
apisix init_etcd
apisix start
Dockerfile部署
Dockerfile
FROM centos:7
# 安装etcd
RUN yum install -y wget make && cd /usr/local/
RUN wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
RUN tar -xvf etcd-v3.4.13-linux-amd64.tar.gz
RUN rm -rf etcd-v3.4.13-linux-amd64.tar.gz
RUN cd etcd-v3.4.13-linux-amd64 && cp -a etcd etcdctl /usr/bin/
# 安装openresty和lua库
RUN yum install yum-utils
RUN yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
RUN yum install -y openresty curl git gcc openresty-openssl111-devel unzip
RUN curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -
# 安装apisix
RUN yum install -y https://github.com/apache/apisix/releases/download/2.6/apisix-2.6-0.x86_64.rpm
# 容器运行时开启etcd
CMD nohup etcd &
构建镜像
docker build -t my_apisix .
启动apisix
启动镜像后
在当前工作空间下
apisix init
apisix init_etcd
apisix start
评论区