docker-for-windows

How to read Powershell variable inside Dockerfile?

旧时模样 提交于 2019-12-13 16:27:44
问题 I'm building Docker Desktop for Windows image. I try to pass a variable to a Powershell command, but it does not work. Dockerfile # escape=` FROM microsoft/windowsservercore SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN $someVar="2.60.3" ; echo $someVar Docker build Sending build context to Docker daemon 2.048kB Step 1/3 : FROM microsoft/windowsservercore ---> 2c42a1b4dea8 Step 2/3 : SHELL powershell -Command

C++ print line not printing to console in Docker container

风格不统一 提交于 2019-12-11 17:35:48
问题 I've got a very basic proof-of-concept C++ application, shown below: #include <iostream> int main() { std::cout << "test" << std::endl; return 0; } When this is run locally, it prints test to the Console, as expected. However, when run on a Docker container, nothing is printed. I'm using the microsoft/windowsservercore as for my container. Since this is still proof-of-concept, my Dockerfile consists of copying the exe of my C++ into the image, and then I'm manually running it interactively.

How to seed a docker container in Windows

风流意气都作罢 提交于 2019-12-11 08:36:05
问题 I intended to install a mongodb docker container from Docker Hub, and then insert some data into it. Obviously, a mongodb seed container is needed. So I did the following: created a Dockerfile of Mongo seed container in mongo_seed/Dockerfile and the code in Dockerfile is the following: FROM mongo:latest WORKDIR /tmp COPY data/shops.json . COPY import.sh . CMD ["/bin/bash", "-c", "source import.sh"] The code of import.sh is the following: #!/bin/bash ls . mongoimport --host mongodb --db data -

Error starting Docker container (WSL, docker-ce, Ubuntu 16.04)

落爺英雄遲暮 提交于 2019-12-11 07:21:45
问题 Microsoft Windows [Version 10.0.17134.285], Ubuntu 16.04 (WSL), docker-ce (stable) I am following the instructions here - https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly. I opted for "stable" rather than "edge". I mounted the c drive mapping manually with sudo mkdir /c sudo mount --bind /mnt/c /c rather than the WSL config file way, because I wasn't sure if I wanted it for ALL my WSL instances. Other than that, I followed the instructions. I have

Running powershell or cmd on docker container

安稳与你 提交于 2019-12-11 07:19:26
问题 I want to check the content of my docker container. I want to run a powershell or command prompt inside container so I can list directories. This container image is hosting ASP.NET Web API application using ASP.net 4.6.1 framework. I ran following commands: docker container ls - to list conatiners docker exec -i -t a1da40af6b3c powershell But nothing happens (as shown in the image). Am i missing anything? 回答1: ISE hosted powershell does not work properly with a bunch of things. So try to do

dial tcp lookup: no such host issue on docker windows desktop

半城伤御伤魂 提交于 2019-12-11 06:08:23
问题 I've installed docker on my office windows 10 Pro machine. I'm facing dial tcp lookup issue while trying to pull from the registry. Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.65.1:53: no such host I've tried many possible solutions from online. But I couldn't figure out the issue. Can someone please help me regarding this issue. Thanks. 回答1: I got the same issue and the below settings worked for me. set proxy address as

Docker : Hyper-V was unable to find a virtual switch with name “DockerNAT”

微笑、不失礼 提交于 2019-12-11 02:27:45
问题 I updated my docker for desktop app (Version 2.0.0.3) on Windows 10 pro.But since then my docker is not starting and throwing following error. Hyper-V\Get-VMNetworkAdapter : Hyper-V was unable to find a virtual switch with name "DockerNAT". At C:\Program Files\Docker\Docker\resources\MobyLinux.ps1:121 char:25 + ... etAdapter = Hyper-V\Get-VMNetworkAdapter -ManagementOS -SwitchName $S ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (DockerNAT

Docker fails to build image on Windows for example app

梦想的初衷 提交于 2019-12-10 20:04:46
问题 https://docs.docker.com/get-started/part2/#dockerfile Windows 10 Pro docker version 18.06.0-ce after running docker build -t friendlyhello I get following error: Sending build context to the docker daemon 5.12 KB Step 1/7: FROM python :2.7-slim 2.7-slim : Pulling from library\python no matching manifest for unknown in the list of entries 回答1: I had this same issue on Windows 10. I could continue following the next steps: Right click Docker instance Go to Settings Daemon Advanced Set the

Docker Mount Project error response from daemon on Windows 10

谁说我不能喝 提交于 2019-12-10 17:35:44
问题 I am new in using Docker and I want to mount my project in a container to run it on a Virtual Host. First of all I installed the Docker Toolbox that works for Windows 10. I am using the Docker QuickStart Terminal as my CLI to work with. I tried to pull an image that I will use for my project and it was successfull. Unfortunately when I try to mount my project I get this error. C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: invalid mode: /var/www/app/. See 'C:\Program

How to use the ARG instruction of Dockerfile for Windows image

霸气de小男生 提交于 2019-12-10 10:38:13
问题 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