如何在Windows上使用Boot2Docker构建映像?

时间:2014-09-01 01:37:27

标签: windows docker boot2docker

我在G:\www\project上有我的本地开发文件,我的Dockerfile位于G:\www\project\Dockerfile

目前我无法做docker build -t app .,我的Dockerfile是这样的:

FROM ubuntu:14.10

RUN apt-get update && apt-get upgrade -y --force-yes && apt-get -y install software-properties-common --force-yes
RUN locale-gen pt_BR.UTF-8 
ENV LANG pt_BR.UTF-8 
ENV LC_ALL pt_BR.UTF-8

ENV DEBIAN_FRONTEND noninteractive

RUN add-apt-repository -y ppa:nginx/stable 
RUN add-apt-repository -y ppa:ondrej/php5
RUN apt-get -y install nginx php5-fpm php5-mysql php-apc php5-mcrypt php5-gd

RUN echo "cgi.fix_pathinfo = 0;" >> /etc/php5/fpm/php.ini

ADD https://raw.github.com/h5bp/server-configs-nginx/master/h5bp/location/expires.conf /etc/nginx/conf/expires.conf 
ADD https://raw.github.com/h5bp/server-configs-nginx/master/h5bp/directive-only/x-ua-compatible.conf /etc/nginx/conf/x-ua-compatible.conf 
ADD https://raw.github.com/h5bp/server-configs-nginx/master/h5bp/location/cross-domain-fonts.conf /etc/nginx/conf/cross-domain-fonts.conf 
ADD https://raw.github.com/h5bp/server-configs-nginx/master/h5bp/location/protect-system-files.conf /etc/nginx/conf/protect-system-files.conf

RUN mkdir /srv/www

ADD ./docker/default /etc/nginx/sites-available/default 
ADD ./docker/nginx.conf /etc/nginx/nginx.conf

RUN sed -i -e '/access_log/d' /etc/nginx/conf/expires.conf 
RUN sed -i -e 's/^listen =.*/listen = \/var\/run\/php5-fpm.sock/' /etc/php5/fpm/pool.d/www.conf

ADD ./docker/start.sh /start.sh

ADD ./application /srv/www/application 
ADD ./bower_components /srv/www/bower_components 
ADD ./content /srv/www/content 
ADD ./javascripts /srv/www/javascripts 
ADD ./modules /srv/www/modules 
ADD ./stylsheets /srv/www/stylesheets 
ADD ./system /srv/www/system 
ADD ./index.php /srv/www/index.php

EXPOSE 80 443
RUN chmod +x /start.sh

ENTRYPOINT ["/start.sh"]

我已经看过OSX的解决方法但没有Windows的解决方法。试图将VirtualBox Guest Additions安装到tinycorelinux,但它没有将图像挂载到sr0

1 个答案:

答案 0 :(得分:0)

是的,Windows目前没有支持的Docker客户端(虽然它正在运行)

而iirc,Boot2Docker 1.3是硬编码的,假设您的用户目录在C::/

因此,快速实现目标的最佳解决方案是将文件scp到vm,然后在那里运行构建。

(来自G:\Users\project

$ scp * docker@$(boot2docker ip):~/ $ boot2docker ssh $$ docker build -t app . $$ docker run --rm -it app bash