简体   繁体   中英

Using docker-compose with the docker context command

Does docker-compose support the docker contex t command? I have setup a context to a VirtualBox VM and I was hoping to run docker-compose but it always deploys to the Docker For Mac default context. This setup has worked great using the docker stack command and a five node swarm I have setup.

Is there something in how docker-compose works that prevents it from being able to work with the docker context command?

As Bret Fisher pointed out to me the docker CLI and docker-compose CLI are totally different CLI's to the docker engine with differing command sets. I did find that there is a context parameter in docker-compose 1.26-rc1 but it does not seem to work correctly. However, RTFM on the "docker context" I did find that there is a "--context" parameter which works great.

Using the "--context" parameter, in my opinion, is a better option than using the "docker context use" command. In my case, when I restart Docker For Mac after a reboot it hanged until I remembered to restart the VM I had pointed the context to before I reboot OS/X. Without the VM I would have had to tweak the ~/.docker/contexts/ file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM