2016-09-25 7 views
0

continuumio/anaconda3ダッカーコンテナを実行するデプロイ可能なデータサイエンス環境をubuntu/trusty64バグボックスに書き込もうとしています。これはうまく動作するようですが、コンテナはすぐにシャットダウンします。文書hereに続いて、私はd.rund.cmdコマンドを成功させようとしました。私は(私はすでにthis guideに従うことによって、Apacheのhttpdのと似たようなやった)私はlocalhost:8888からノートブックにアクセスできることをバグラン+ドッカー:開始されたコンテナは決して「停止」状態を残していません

docker run -i -t -p 8888:8888 continuumio/anaconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser" 

のでドッカーコマンドを渡すのベイグラント相当を行うことができるようにしたいと思います。残念ながら、私はちょうどこれのための構文を取得するように見えることはできません、どんな助けていただければ幸いです。

以下に私のHostVagrantfileとVagrantfileを含めました。

HostVagrantfile:

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

# Specify Vagrant version, Vagrant API version, and Vagrant clone location 
Vagrant.require_version ">= 1.6.0" 
VAGRANTFILE_API_VERSION = "2" 

# Create and configure the VM(s) 
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 

    # Use Docker provisioner 
    config.vm.provision "docker" 

    # Workaround 
    config.vm.provision "shell", inline: 
    "ps aux | grep 'sshd:' | awk '{print $2}' | xargs kill" 

    # Assign a friendly name to this host VM 
    config.vm.hostname = "docker" 

    config.vm.box = 'ubuntu/trusty64' 

    config.vm.network "forwarded_port", guest: 8888, host: 8888 

    config.vm.synced_folder ".", "/vagrant" 
end 

Vagrantfile:

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

# Specify Vagrant version and Vagrant API version 
Vagrant.require_version ">= 1.6.0" 
VAGRANTFILE_API_VERSION = "2" 
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker' 

# Create and configure the Docker container(s) 
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 

    config.vm.define "apache" do |a| 

    a.vm.provider "docker" do |d| 

     d.image = "continuumio/anaconda3" 
     d.name = "anacond3-container" 
     d.ports = ["80:80", "433:443", "8888:8888"] 
     d.remains_running = true 
     d.vagrant_vagrantfile = "HostVagrantfile" 
    end 
    end 
end 

更新 これは、実行しようとしたときに、私が得る結果である:

$ vagrant docker-run -i -t -p 8888:8888 continuumio/anaconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser"

An invalid option was specified. The help for this command 
is available below. 

Usage: vagrant docker-run [command...] 

Options: 

     --[no-]detach    Run in the background 
    -t, --[no-]tty     Allocate a pty 
    -r, --[no-]rm,     Remove container after execution 
    -h, --help      Print this help 
+0

を、あなたは '放浪ドッキングウィンドウを実行しようとしませんでした-run -it apache -p 8888:8888 continuumio/anaconda3 -/bin// opt/notebooks &&/opt/conda/bin/jupyter notebook --notebook-dir =/opt/notebooks --ip = '/ opt/conda/bin/* '--port = 8888 --no-browser' ' –

+0

私はこの問題の出力を更新しました – jhole89

答えて

0

最終的に自分自身で解決することができました。ドッキングウィンドウrunコマンド放浪ドッキングウィンドウの実行、引数、画像を引いた後、CMDコマンドを使用して

docker run -i -t -p 8888:8888 continuumio/anaconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser" 

に分割する必要がありました。代わりに

config.vm.provider "docker" do |d| 
    d.image = "continuumio/anaconda3" 
end 

使用

config.vm.provision "docker" do |d| 
    d.pull_images "continuumio/anaconda3" 
    d.run "continuumio/anaconda3", 
    args: "-t -p 8888:8888", 
    cmd: $jupyterServer 
end 

$jupyterServer = <<SCRIPT 
/bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser" 
SCRIPT 

を定義を使用して、私はまた一つに2 Vagrantfiles組み合わせ:

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

# Specify Vagrant version, Vagrant API version 
Vagrant.require_version ">= 1.6.0" 
VAGRANTFILE_API_VERSION = "2" 

$jupyterServer = <<SCRIPT 
/bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser" 
SCRIPT 

# Create and configure the VM(s) 
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 

    config.vm.box = "ubuntu/trusty64" 

    config.vm.provider "virtualbox" do |vb| 
    vb.customize ["modifyvm", :id, "--memory", "2048"] 
    vb.customize ["modifyvm", :id, "--cpus", "2"] 
    end 

    # Use Docker provisioner 
    config.vm.provision "docker" do |d| 
    d.pull_images "continuumio/anaconda3" 
    d.run "continuumio/anaconda3", 
     args: "-t -p 8888:8888", 
     cmd: $jupyterServer 
    end 

    config.vm.network "forwarded_port", guest: 8888, host: 8888 
    config.vm.synced_folder ".", "/vagrant" 
end 
関連する問題