Help us understand the problem. What is going on with this article?

VSCodeのDocker接続先をVagrantで起動したDockerサーバにする

More than 1 year has passed since last update.

Docker Toolbox使った方がいいんだろうけど、あえてやる

準備

vagrant-docker-composeプラグインをインストール

vagrant install vagrant-docker-compose

Vagrantfileを用意する

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.network "forwarded_port", guest: 2375, host: 2375, host_ip: "127.0.0.1"
  config.vm.provision :docker
  config.vm.provision :docker_compose
  config.vm.provision "shell", inline: <<-SHELL
    service docker stop
    nohup dockerd -H 0.0.0.0:2375 > /tmp/nohup.out 2>&1 &
  SHELL
end

Dockerサーバーを立ち上げる

vagrant up

(確認用に)Dockerコンテナを起動

vagrant ssh -- sudo docker -H 127.0.0.1:2375 run hello-world

VSCodeのDocker設定

設定画面を開きdocker.hostで検索。
以下のように設定する
image.png

Dockerメニューを開くと、先ほど起動したDockerイメージとコンテナが表示される。
image.png
右クリックで消したりできる

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした