Vscode-docker: How to setup configs with docker-machine.

Created on 1 May 2019  路  8Comments  路  Source: microsoft/vscode-docker

Currently, I'm on mac os and installed docker-toolbox using brew with version info

~ brew cask info docker-toolbox
docker-toolbox: 18.06.1-ce
https://www.docker.com/products/docker-toolbox
/usr/local/Caskroom/docker-toolbox/18.06.1-ce (205.3MB)
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/docker-toolbox.rb
==> Name
Docker Toolbox
==> Artifacts
DockerToolbox-18.06.1-ce.pkg (Pkg)

I read docs on setup with docker-machine. I got the value of docker host from

~ docker-machine env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/trmaphi/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell: 
# eval $(docker-machine env)

Then, I copied DOCKER_HOST value inside global settings.json, but I got message noti from vscode said Unable to connect to Docker. Please make sure you have installed Docker and that it is running. Details: connect ECONNREFUSED 127.0.0.1:80

How do I config my global settings.json to connect this extension with docker-machine

P1

Most helpful comment

Hi all - just merged #998 to support the following VS Code settings:

docker.host - equivalent to DOCKER_HOST
docker.certPath - equivalent to DOCKER_CERT_PATH
docker.tlsVerify - equivalent to DOCKER_TLS_VERIFY
docker.machineName - equivalent to DOCKER_MACHINE_NAME

Feel free to try the latest build from master and let us know if it works for ya! See these instructions: https://aka.ms/azCodeInsiders

All 8 comments

I think using DOCKER_HOST is a much better way to do remote builds.
Preferably, a per project setting for DOCKER_HOST, DOCKER_TLS_VERIFY and DOCKER_CERT_PATH will be availble.

Edit: Personally I've been using a Makefile for docker-compose --build up

build:
    @ eval $$(docker-machine env default); \
    docker-compose up --build -d

@atomi could you show me .vscode/settings.json in your workspace?

I couldn't find any settings options for DOCKER_TLS_VERIFY and DOCKER_CERT_PATH

@trmaphi I don't use a .vscode/settings.json file.
By the way VSCode also passes environment variables set in your shell.
So you can set them there also.

Is this an issue only with the tree view, or are commands sent to shell affected too?

We rely on dockerode for populating the tree view, and we've seen issues ensuring docker_host is honored. We shall look into this.

Hi all - just merged #998 to support the following VS Code settings:

docker.host - equivalent to DOCKER_HOST
docker.certPath - equivalent to DOCKER_CERT_PATH
docker.tlsVerify - equivalent to DOCKER_TLS_VERIFY
docker.machineName - equivalent to DOCKER_MACHINE_NAME

Feel free to try the latest build from master and let us know if it works for ya! See these instructions: https://aka.ms/azCodeInsiders

@EricJizbaMSFT just to confirm your update works as advertised! Thank you.

@EricJizbaMSFT @PrashanthCorp The built in terminal appears to not use the DOCKER_* env variables from VS Code settings. I think most people would expect the terminal to honor the DOCKER_* variables set in their settings.

@atomi please create a new issue if you would like that behavior. The built in terminal uses those env vars when we create a terminal for docker commands, but not on every terminal you manually create

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kludex picture Kludex  路  7Comments

oberfoerster picture oberfoerster  路  6Comments

samhwang picture samhwang  路  4Comments

bradygmsft picture bradygmsft  路  7Comments

calbot picture calbot  路  7Comments