如何在这个meteordocker图像部署应用程序?

我正在使用https://github.com/CyCoreSystems/docker-meteor来运行我的meteor应用程序。

我成功地从github库中的Dockerfile构build了docker镜像。

我现在有一个问题是我不知道什么命令来运行泊坞窗图像。

关于如何使用图像的说明并不多。

如果我只运行docker run -i -t ulexus/meteor /bin/bash ,将会出现抱怨'/var/www/main.js'的错误。

但是,我怎样才能将我的meteor应用程序源代码复制到容器中,而无需运行容器?

也许我需要在指令中使用类似示例的代码: docker run --rm -e ROOT_URL=http://testsite.com -e REPO=https://github.com/yourName/testsite -e BRANCH=testing -e MONGO_URL=mongodb://mymongoserver.com:27017 ulexus/meteor

但我的应用程序回购是一个私人的,而不是github公众。 不知道如何在命令中指定我的用户名/密码。

==========

我用来创build图像的Dockerfile是这样的:

 # DOCKER-VERSION 1.2.0 # METEOR-VERSION 1.0.0 FROM stackbrew/ubuntu:trusty RUN apt-get update ### For latest Node RUN apt-get install -y software-properties-common RUN add-apt-repository -y ppa:chris-lea/node.js RUN apt-get update RUN apt-get install -y build-essential nodejs ### ### For standard Ubuntu Node #RUN apt-get install -y build-essential nodejs npm #RUN ln -s /usr/bin/nodejs /usr/bin/node ### # Install git and curl RUN apt-get install -y git curl # Make sure we have a directory for the application RUN mkdir -p /var/www RUN chown -R www-data:www-data /var/www # Install fibers -- this doesn't seem to do any good, for some reason RUN npm install -g fibers # Install Meteor RUN curl https://install.meteor.com/ |sh # Install entrypoint ADD entrypoint.sh /usr/bin/entrypoint.sh RUN chmod +x /usr/bin/entrypoint.sh # Add known_hosts file ADD known_hosts /root/.ssh/known_hosts EXPOSE 80 ENTRYPOINT ["/usr/bin/entrypoint.sh"] CMD [] 

===========

运行docker run -i -t ulexus/meteor /bin/bash后的错误消息docker run -i -t ulexus/meteor /bin/bash

 Unable to locate server directory; hold on: we're likely to fail module.js:340 throw err; ^ Error: Cannot find module '/var/www/main.js' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:906:3 

我不确定你的命令docker run -i -t ulexus/meteor /bin/bash是什么意思,因为使用-i-t/bin/bash结尾,这只是启动映像运行交互式bash会话。 这是如何创buildmain.js错误? 你的Dockerfile是什么样的? 我使用以下命令运行启动一个简单的sshd进程的testing服务器: docker run -p 22:22 --rm=true --name sshd-server sshd 。 这里命名的图像(在你的情况下,ulexus / meteor) sshd被启动,结果容器的名字是sshd-server 。 需要注意的是/bin/bash命令在结尾处缺失,以及-i-t并且在Dockerfile中有一个CMD条目。 这里是我的CMD ["/usr/sbin/sshd", "-D"] ,这里是Dockerfile本身的副本:

 FROM debian:wheezy RUN apt-get update RUN apt-get upgrade RUN apt-get -y install openssh-server RUN echo 'root:root' | chpasswd RUN mkdir /var/run/sshd CMD ["/usr/sbin/sshd", "-D"] EXPOSE 22 

你的CMD入口应该是启动meteor的东西。

然后你的docker命令会看起来像这样:

 docker run -p hostPort:containerPort --rm ulexus/meteor 

再次注意, -i-t/bin/bash都丢失了。 hostPort:containerPort是这样的,我可以打开一个networking( ssh )连接到容器。

希望有所帮助!

作为替代解决scheme,请尝试: https : //github.com/chriswessels/meteor-tupperware

它会让你把你的Meteor.js应用程序变成一个精简的,生产就绪的Docker镜像。

从使用文档:

快速开始

在您的Meteor.js项目目录中,运行以下命令:

curl https://raw.githubusercontent.com/chriswessels/meteor-tupperware/master/quickstart.sh > /tmp/quickstart.sh && sh /tmp/quickstart.sh

这个脚本将把一个Dockerfile和.dockerignore写入你的当前目录,如下所示进行预configuration。

运行快速启动脚本之后,假设你运行了Docker,可以运行以下命令来构buildMeteor.js应用程序的映像:

docker build -t yourname/app .

免责声明:我是这个工具的作者。