docker-for-windows

Access file of windows machine from docker container

萝らか妹 提交于 2019-12-06 15:46:29
I have installed Docker Desktop for Windows in Windows 10 operating system. I am running a python script inside docker container which reads file from disk and add few text at the end of files. Now the requirement is to read files from Windows 10 and perform the same operation on it. Is it possible in docker to read files from OS on top of which Docker is running? Of course, you can use volumes . For example, you can run the following command: docker run -v path/to/your/file/on/host:path/to/the/file/on/container your_image The only approach to access the host file is that you can mount the

How to use the ARG instruction of Dockerfile for Windows image

我的未来我决定 提交于 2019-12-06 11:09:58
I would like to pass an argument in my dockerfile to build my docker image. I've seen in other post and docker manual how to do this but it doesn't work in my case. Here is an extract of my code where i use my argument: ARG FirefoxVersion RUN powershell -Command iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); RUN choco install -y firefox --version $FirefoxVersion --ignore-checksums I build my image with this command in powershellPrompt : docker build -t myimage --build-arg FirefoxVersion=61.0.1 . Finally I have this error : '$FirefoxVersion' is not a

yum update / apk update / apt-get update not working behind proxy

时间秒杀一切 提交于 2019-12-06 03:14:44
I'm behind a proxy and I'm not able to build a Docker image. I tried with FROM ubuntu , FROM centos and FROM alpine , but apt-get update / yum update / apk update failed. My host OS is Windows 10, so I configured my Docker settings to use our proxy. And I also added ENV http_proxy http://<PROXY> ENV https_proxy http://<PROXY> to my Dockerfile but no success. I also tried to set my proxy to http://<USER>:<PASS>@<PROXY> , but again no success. I am able to pull Docker images. When I set my proxy settings to no proxy , I'm not able to pull images, so I guess my proxy URL is correct. Any ideas

Cannot call chown inside Docker container (Docker for Windows)

a 夏天 提交于 2019-12-05 08:46:00
I am attempting to use the official Mongo dockerfile to boot up a database, I am using the -v command to map a local directory to /data inside the container. As part of the Dockerfile , it attempts to chown this directory to the user mongodb: RUN mkdir -p /data/db /data/configdb \ && chown -R mongodb:mongodb /data/db /data/configdb VOLUME /data/db /data/configdb However, this fails with the following command: chown: changing ownership of '/data/db': Permission denied What I am doing wrong here? I cannot find any documentation around this - surely the container should have full permissions to

Dockerfile COPY from a Windows file system to a docker container

 ̄綄美尐妖づ 提交于 2019-12-05 07:51:54
I have a simple Dockerfile : FROM php:7.1-apache LABEL maintainer="rburton@agsource.com" COPY C:/Users/rburton/code/MyAgsourceAPI /var/www It is the last line that is giving me problems. I am copying from a Windows structure to a docker container (Linux I assume). When I build this image I get: ... Step 3/3 : COPY C:/Users/rburton/code/MyAgsourceAPI /var/www COPY failed: stat /var/lib/docker/tmp/dockerbuilder720374851/C:/Users/rburton/code/MyAgsourceAPI: no such file or directory First, something is preventing the recognition that this is an absolute path and naturally if the path is pre

How to restart docker for windows process in powershell?

最后都变了- 提交于 2019-12-05 07:47:16
I want to restart docker for windows in powershell. just like I can do it with one command in powershell. May I implement it? When using Restart-Service *docker* : Kill and restart the docker process: $processes = Get-Process "*docker desktop*" if ($processes.Count -gt 0) { $processes[0].Kill() $processes[0].WaitForExit() } Start-Process "C:\Program Files\Docker\Docker\Docker Desktop.exe" In the if clause I check if any running docker process has been found. There should never be more than 1 instance of "Docker Desktop" running so you can then kill the first one in the list. To restart you

Cannot create Windows docker machine? “Hyper-V PowerShell Module is not available”

此生再无相见时 提交于 2019-12-05 06:22:38
I just installed docker and tried to create a Windows (not Linux) docker machine but it failed? PS C:\> docker-machine.exe create --driver hyperv default Creating CA: C:\Users\...\.docker\machine\certs\ca.pem Creating client certificate: C:\Users\...\.docker\machine\certs\cert.pem Running pre-create checks... Error with pre-create check: "Hyper-V PowerShell Module is not available" I downloaded the newer version of docker-machine ( https://github.com/docker/machine/releases/tag/v0.15.0 ) and a new error occurred. PS C:\> .\bin\docker-machine-Windows-x86_64.exe create --driver hyperv default

Dockerizing a Windows Service Docker for Windows

ぐ巨炮叔叔 提交于 2019-12-05 06:15:20
问题 I have a existing Windows Service which I want to move to docker container in windows. I'm new to this. If somebody can help me how to create docker image to move windows service into docker, it would be helpful. 回答1: First, download wait-service script You need to write dockerfile like this FROM microsoft/windowsservercore SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] WORKDIR / COPY Wait-Service.ps1 service.exe ./ RUN install

Change file permissions in mounted folder inside docker container on Windows Host

旧巷老猫 提交于 2019-12-05 00:28:38
问题 Disclaimer/Edit 2 Some years later, for everyone reading this question - If you are on Windows and want to use docker with linux containers, I highly recommend not using docker for windows at all and instead starting the entire docker environment inside a VM altogether. This Ext3 NTFS issue will break your neck on so many different levels that installing docker-machine might not even be worth the effort. Edit: I am using docker-machine which starts a boot2docker instance inside a Virtualbox

How to pass parameters to a .NET core project with dockerfile

半腔热情 提交于 2019-12-04 23:28:11
I've got a .NET Core project (using visual studio and adding the docker files via the Visual Studio Tools for Docker ). My DockerFile looks like this: FROM microsoft/dotnet:1.0.1-core ARG source=. WORKDIR /app COPY $source . ENTRYPOINT ["dotnet", "MyApp.dll"] CMD ["arg1", "arg2"] My question is, how do I pass parameters into the project? public static void Main(string[] args) { // how does `args` get populated? } I used environment variables which can be set by docker-compse.yml too public static class EnvironmentHelper { public const string EnvironmentArguments = "DOTNETCORE_ARGUMENTS";