Docker for Windows - docker

When I try to run any container on Docker on Windows I get the following error.
docker: Error response from daemon: container
70518b4959aca4092b2f65c0881a6c25851789656e3d7ce2610e6322b32aeffe
encountered an error during CreateContainer: failure in a Windows
system call: The system cannot find the path specified. (0x3) extra
info:
{
"SystemType": "Container",
"Name": "70518b4959aca4092b2f65c0881a6c25851789656e3d7ce2610e6322b32aeffe",
"Owner": "docker",
"IgnoreFlushesDuringBoot": true,
"LayerFolderPath": "C:\\ProgramData\\Docker\\windowsfilter\\70518b4959aca4092b2f65c0881a6c25851789656e3d7ce2610e6322b32aeffe",
"Layers": [
{
"ID": "db3c3c75-2b7c-5d4a-bde3-463ffc817a5b",
"Path": "C:\\ProgramData\\Docker\\windowsfilter\\61ad8a0caffe153621375482f419c592edaade796b909edd8a7edda142818414"
},
{
"ID": "3e2f377e-6c2f-5b95-9e80-fceef67d4b01",
"Path": "C:\\ProgramData\\Docker\\windowsfilter\\54a8c9c1afb96bd64a3dd69f0f84aee1eaf18644791cf2812caeab26adf12632"
}
],
"HostName": "70518b4959ac",
"HvPartition": true,
"EndpointList": [
"36bbd687-56fb-4281-a9ee-4f81dcb5a795"
],
"HvRuntime": {
"ImagePath": "C:\\ProgramData\\Docker\\windowsfilter\\61ad8a0caffe153621375482f419c592edaade796b909edd8a7edda142818414\\UtilityVM"
},
"AllowUnqualifiedDNSQuery": true
}.
I believe the error could be related to the underlying hyper-v settings as I received the same error with a brand new vanilla Hyper-V VM set with just a mounted bootable iso disc.
Here is the docker info
Version: 17.11.0-ce-rc3-win38 (14052)
Channel: edge
Sha1: 32de2331204faa0f33731efe56df79e713ee0fba
Started on: 2017/11/15 22:37:53.300
Resources: C:\Program Files\Docker\Docker\Resources
OS: Windows 10 Enterprise
Edition: Enterprise
Id: 1709
Build: 16299
BuildLabName: 16299.15.amd64fre.rs3_release.170928-1534
Steps I have tried all resulting in the same:
1) Install Docker Edge
2) Uninstall and Reinstall Docker
3) Uninstall Hyper-V and reinstall
4) Changing the Hyper-V Storage locations

Related

VSCode DevContainers: How do you mount a home file on both MAC and Windows

I am using VSCode devcontainers, how do you have a mount section in the devcontainers.json with that is compatible for both windows and MAC? I have a problem accessing the source=... section under the "mounts" section.
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.106.0/containers/python-3
{
"name": "Python 3",
"context": "..",
"dockerFile": "Dockerfile",
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "venv/bin/pylint",
},
// Change <username> to user path (Ex. /Users/vfrank/ on a MAC)
"mounts": [
"source=<full home path>/.aws/credentials,target=/home/vscode/.aws/credentials,type=bind,consistency=cached"
],
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "echo 'done'",
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
Works on MAC but not on Windows
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws/credentials,target=/home/vscode/.aws/credentials,type=bind,consistency=cached"
]
Works on windows but not on MAC
"mounts": [
"source=~/.aws/credentials,target=/home/vscode/.aws/credentials,type=bind,consistency=cached"
]
I have docker file sharing setup for C drive on Windows and /Users on MAC, but the error I am getting when using devcontainers is that the folder or file does not exist. I can make it work on both computers so it is not related to file permissions or access from docker.
I am looking for a single source=... command that works on both Windows (10+) and MAC.
If you do this:
"source=${localEnv:HOME}${localEnv:USERPROFILE}\\.aws\\credentials,target=/root/.aws/credentials,type=bind,consistency=cached"
Then only one expansion will be non-empty on each platform and you will get the result you want.

default-address-pools is not recognized by docker

I am trying to configure docker-compose to use different network range by default, so I follow instructions from https://github.com/moby/moby/pull/29376
However, I get following error:
unable to configure the Docker docker daemon with file
/etc/docker/daemon.json: the following directives don't match any
configuration option: default-address-pools
Here is the content of daemon.json - it is the sample taken from the #29376.
{
"default-address-pools": [
{
"scope": "local",
"base": "172.80.0.0/16",
"size": 24
},
{
"scope": "global",
"base": "172.90.0.0/16",
"size": 24
}
]
}
Please advise.
My env:
# uname -a
Linux gfn-classroom 4.4.0-109-generic #132-Ubuntu SMP Tue Jan 9 19:52:39 UTC
2018 x86_64 x86_64 x86_64 GNU/Linux
# docker --version
Docker version 17.12.0-ce, build c97c6d6
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
This is merged in https://github.com/moby/moby/pull/36396 and (hopefully) will be available in 18.06. [Reference]
Also note changing default address pool is also available as a cli argument, e.g.:
/usr/bin/dockerd -H ... --default-address-pool base=172.29.0.0,size=16
Pull-request https://github.com/moby/moby/pull/29376 was closed, not merged, so that feature is not available (yet) in Docker

ansible_default_ipv4.address undefined in docker ubuntu

I am trying to run a simple ansible operation which should update a line in /etc/hosts:
- hosts: localhost
become: true
vars:
master_host: "ansible-master"
tasks:
- hostname: name="{{master_host}}"
- name: Add master host to /etc/hosts
lineinfile: dest=/etc/hosts line="{{ ansible_default_ipv4.address}} {{master_host}}"
regexp=".*{{master_host}}\s*$"
When I run this in virtualbox with ubuntu 16, it works fine.
When I run it in my ubuntu 16 Docker container, I get:
fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field
'args' has an invalid value, which appears to include a variable that
is undefined. The error was: 'ansible_default_ipv4' is
undefined\n\nThe error appears to have been in
'/home/user/ansible/manage-ansible-master.yml': line 11, column 5, but
may\nbe elsewhere in the file depending on the exact syntax
problem.\n\nThe offending line appears to be:\n\n - hostname:
name=\"{{master_host}}\"\n - name: Add master host to /etc/hosts\n
^ here\n"}
Where is ansible trying to pull the local ip from and why can't it do so in docker?
BTW I have installed net-tools in my docker container and it has an eth0 ip.
On virtualbox and in docker I have a line in /etc/hosts
ansible-master 127.0.1.1
UPDATE:
I run
ansible all --connection=local -m setup | less
on virtualbox ubuntu and Docker ubuntu.
On Virtualbox I get a lot of network-related info that I don't get on Docker:
"ansible_facts": {
"ansible_all_ipv4_addresses": [
<ip>,
<another ip>
],
"ansible_all_ipv6_addresses": [
<ipv6>,
<another ipv6>
],
Also in virtualbox I get
"ansible_default_ipv4": {
"address": <value>,
"alias": <value>,
"broadcast": <value>,
"gateway": <value>,
"interface": <value>,
"macaddress": <value>,
"mtu": <value>,
"netmask": <value>,
"network": <value>,
"type": <value>
},
None of this appears in Docker.
I have had a similar problem with fedora; the solution was to install the package that provides the 'ip' command (which is used to generate the fact your looking for). in the case of fedora 'dnf install iproute'.
For Ubuntu, you have to install the iproute2 package in your pre_tasks. Don't forget to gather facts again in another task with - setup: afterwards.
Use hostname flag to put your local container hostname in /etc/hosts:
docker run --hostname=my_hostname

What is the difference between running docker image in and outside of vagrant

Can anyone explain what is the difference of using docker images inside vagrant and outside of vagrant?
And how to deploy chaincode to the network that is running in docker containers outside of vagrant?
Now I have a network of 4 peers outside of vagrant, I'm trying to deploy a chaincode from github:
{
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID": {
"path": "https://github.com/aybek/test_ibm_chaincode"
},
"ctorMsg": {
"function": "init"
},
"metadata": [97, 115, 115, 105, 103, 110, 101, 114],
"secureContext": "admin"
},
"id": 0
}
Output:
Error when deploying chaincode: Error getting chaincode package bytes: Error getting code Getting chaincode took too long
It is recommended to run the docker containers outside of vagrant. There is a good example of how to run the docker containers and install/instantiate chaincode in the Fabric v1.0 documentation:
https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html

Marathon With Private Docker Repo

I'm having issues pulling from a private docker repo when I add a marathon application. I've tarred my ~/.docker folder (including the docker.config file which contains my login information) and distributed that along to my mesos slaves as /etc/docker.tar.gz (I'm using docker 1.6.2).
I've then added a new marathon app with:
dcos marathon add app marathon.json
My marathon.json is as follows:
{
"id": "api",
"cpus": 1,
"mem": 1024,
"instances": 1,
"container": {
"type": "DOCKER",
"docker": {
"image": "company/api",
}
},
"args": ["java", "-jar", "api.jar"],
"uris": [
"file:///etc/docker.tar.gz"
]
}
The marathon app never starts, however. In my slave logs I've found the following line:
Container x for executor y of framework z failed to start: Failed to 'docker pull company/api': exit status = exited with status 1 stderr = time="2015-11-12T00:03:57Z" level=fatal msg="Error: image company/api:latest not found"
How can I get this to pull correctly?

Resources