docker启动YAPI项目初步实践

2020-03-30  本文已影响0人  MYSUNFLOWER

服务器:linux(CentOS 7.6)

查看内核版本命令(cat /etc/redhat-release)

步骤一:安装docker,由于用的测试服务器有网络权限,采用离线安装(用的是docker-ce版)

参考:https://www.cnblogs.com/luoSteel/p/10038954.html

步骤二:安装node以及mongodb并运行:

参考:https://www.runoob.com/docker/docker-install-node.html 以及 https://www.runoob.com/docker/docker-install-mongodb.html

如果出现情况:

docker: Error response from daemon: Conflict. The container name "/mongo-yapi" is already in use by container "a2db49e4fc36e1c45049b30794dc021b908b5c9ea090fecc967ce61f945f6b77". You have to remove (or rename) that container to be able to reuse that name.

解决方案:

先查看 :docker container ls -all  (或者 docker ps -a)

再remove :docker rm 【container id】

步骤三:拉取yapi项目、设置初始化管理员账号并启动

1、docker pull registry.cn-hangzhou.aliyuncs.com/anoy/yapi

2、docker run -it --rm \

  --link mongo-yapi:mongo \

  --entrypoint npm \

  --workdir /api/vendors \

  registry.cn-hangzhou.aliyuncs.com/anoy/yapi \

  run install-server

3、docker run -d \

  --name yapi \

  --link mongo-yapi:mongo \

  --workdir /api/vendors \

  -p 3000:3000 \

  registry.cn-hangzhou.aliyuncs.com/anoy/yapi \

  server/app.js

参考:https://www.jianshu.com/p/a97d2efb23c5

上一篇下一篇

猜你喜欢

热点阅读