所以,在我开始之前,我是新手,因为当我给自己一个项目时我学得最好,所以我想用Vagrant和Docker来制作一个简单的Node和Express服务器,并在实际容器之外使用一个共享文件夹。 我跟着一个教程,解释类似的事情与Nginx和PHP(工作),所以请如果问题不是很好的结构或我的英语不完美让我知道!
正如我所说我想练习Docker(我最近开始使用它)并学习Vagrant。 这是我的Dockerfile:
FROM ubuntu:latest RUN apt-get update RUN apt-get install -y software-properties-common RUN apt-get update RUN apt-get -y dist-upgrade RUN apt-get install -y nodejs npm RUN cd /home RUN npm install -g express RUN npm install -g express-generator RUN ln -s /usr/bin/nodejs /usr/bin/node RUN express projekt RUN cd projekt && npm install VOLUME ["/home/projekt/"] EXPOSE 3000 RUN DEBUG=projekt:* /home/projekt/bin/www
这个projekt
也是故意拼写的,因为它是我的语言。 所以我基本上想要安装节点和NPM。 然后,我想要生成Express项目和sym链接节点和nodejs。 现在的问题是最后一个命令失败。 它说:
/bin/sh: 1: /home/projekt/bin/www: not found
这是我的stream浪文件:
Vagrant.configure(2) do |config| config.vm.synced_folder "./www", "/home/projekt" # Sync'd folder config.ssh.port = "22" config.vm.provider "docker" do |d| d.build_dir = "./Docker" # specifies the path to the Dockerfile d.ports = [ '80:3000' ] # Forwards port 8080 from the host to the Docker Container port 80 end end
这是我的根项目文件夹的外观:
. ├── Docker │ └── Dockerfile ├── Vagrantfile └── www 2 directories, 2 files
另外,如果这个问题不适合这个StackExchange请你直接指点我可以问这个!