While 运行 Docker 容器出现错误 "current working directory, nor any of its parents, seems to be a Nanoc site"
The While running Docker container getting error "current working directory, nor any of its parents, seems to be a Nanoc site"
我的docker文件
FROM ruby:latest
# Create app directory
WORKDIR /usr/src/app
COPY Gemfile .
# Copy the files
COPY . ./docs
RUN bundler install
RUN bundle exec nanoc
EXPOSE 5300
CMD [ "nanoc", "view" ]
而 运行 构建容器:
步骤:1
成功构建2fa7cc6d083b
步骤:2
root@ubuntu:/var/docs# docker run -p 0.0.0.0:4300:4300 --name nanoc-latest -t -d nanoc:latest
414b227902d15bbe831d8c77f7c68a3c2ca48ae20c9f20e68f92d52f55350b31
步骤:3
root@ubuntu:/var/docs# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
步骤:4
root@ubuntu-s-2vcpu-2gb-sgp1-01:/var/docs# docker ps -a
已创建容器 ID 映像命令
状态端口名称
414b227902d1 nanoc:latest "/bin/sh -c /usr/loc…" 9 seconds ago Exited (1) 6 seconds ago nanoc-latest
步骤:5
root@ubuntu:/var/docs# sudo docker logs 414b227902d1
检测到 Gemfile,但未加载 Bundler。这可能不是您想要的。要使用 Bundler 运行 Nanoc,请使用 bundle exec nanoc
.
错误:当前工作目录及其父目录似乎是 Nano c 站点。
我尝试打开 nanoc 图像容器
root@ubuntu:/var/docs# docker run -ti --entrypoint=sh nanoc
# ls
Gemfile Gemfile.lock docs
# cd docs
# ls
Dockerfile Gemfile m1 m2 m3 m6
所以没有 nanoc 文件。
Docker 文件:
FROM ruby:2.3
RUN mkdir -p /user/src/app
COPY . /usr/src/app
WORKDIR /usr/src/app/docs
RUN bundle install
RUN bundle exec nanoc
EXPOSE 3000
CMD bundle exec nanoc view
Docker 构建命令:
docker build -f Dockerfile -t nanoc:latest .
docker run -p 0.0.0.0:3000:3000 --name nanoc-latest -t -d nanoc:latest
您成功获得部署的 index.html 文件
我的docker文件
FROM ruby:latest
# Create app directory
WORKDIR /usr/src/app
COPY Gemfile .
# Copy the files
COPY . ./docs
RUN bundler install
RUN bundle exec nanoc
EXPOSE 5300
CMD [ "nanoc", "view" ]
而 运行 构建容器:
步骤:1
成功构建2fa7cc6d083b
步骤:2
root@ubuntu:/var/docs# docker run -p 0.0.0.0:4300:4300 --name nanoc-latest -t -d nanoc:latest
414b227902d15bbe831d8c77f7c68a3c2ca48ae20c9f20e68f92d52f55350b31
步骤:3
root@ubuntu:/var/docs# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
步骤:4
root@ubuntu-s-2vcpu-2gb-sgp1-01:/var/docs# docker ps -a
已创建容器 ID 映像命令
状态端口名称
414b227902d1 nanoc:latest "/bin/sh -c /usr/loc…" 9 seconds ago Exited (1) 6 seconds ago nanoc-latest
步骤:5
root@ubuntu:/var/docs# sudo docker logs 414b227902d1
检测到 Gemfile,但未加载 Bundler。这可能不是您想要的。要使用 Bundler 运行 Nanoc,请使用 bundle exec nanoc
.
错误:当前工作目录及其父目录似乎是 Nano c 站点。
我尝试打开 nanoc 图像容器
root@ubuntu:/var/docs# docker run -ti --entrypoint=sh nanoc
# ls
Gemfile Gemfile.lock docs
# cd docs
# ls
Dockerfile Gemfile m1 m2 m3 m6
所以没有 nanoc 文件。
Docker 文件:
FROM ruby:2.3
RUN mkdir -p /user/src/app
COPY . /usr/src/app
WORKDIR /usr/src/app/docs
RUN bundle install
RUN bundle exec nanoc
EXPOSE 3000
CMD bundle exec nanoc view
Docker 构建命令:
docker build -f Dockerfile -t nanoc:latest .
docker run -p 0.0.0.0:3000:3000 --name nanoc-latest -t -d nanoc:latest
您成功获得部署的 index.html 文件