青野 发表于 2019-2-19 11:11:25

windows 2008 开机启动 Docker Toolbox 并运行容器

  新建 docker-startup.bat

@echo off
REM Set the name of the VM configuration where dockerd will be hosted
set BOOT2DOCKER_VM=default
set PATH=%PATH%;"D:\Program Files\Docker Toolbox\"
REM Start the default machine (or any other machine)
docker-machine start %BOOT2DOCKER_VM%
REM docker-compose up or docker run
docker-compose up -d

  因为我使用Docker Compose管理多个容器,你也可以直接docker run 运行镜像

  创建并设置任务计划

  设置为系统启动时执行计划

  指定要执行的脚本

  “程序或脚本” 选择刚创建的docker-startup.bat
  “起始于” D:\Program Files\Docker Toolbox\

  “起始于” 指向docker-startup.bat所在的目录且不能用双引号包括

  开机自动执行脚本后服务会在后台运行,打开VirtualBox会显示镜像是关闭状态,莫慌,已在后台启动了(被坑得不要不要的。。。)

  打开Docker Quickstart Terminal会报错,因为已被后台占用

  开机后稍等一会,让服务跑起来,ssh到docker

  enjoy life
  参考:
https://serverfault.com/questions/753971/windows-how-to-start-docker-vm-att-system-boot
  来源:windows 2008 开机启动 Docker Toolbox 并运行容器



页: [1]
查看完整版本: windows 2008 开机启动 Docker Toolbox 并运行容器