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

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

Related

Docker for Windows

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

Getting error while running the Mesos container in mesos cluster using marathon

"container": {
"type": "MESOS",
"docker": {
"image": "redis",
"forcePullImage": false
}
}
The above example has the container type as Mesos..but again specifying "docker" image... for using universal container or mesos container, do we need to install docker?
because, when i try to run a sample in mesos with type "mesos" container, i am getting error like this:
unsupported container image:DOCKER.
I have not installed docker.
I am using Mesos1.1 version
See https://mesosphere.github.io/marathon/docs/native-docker.html#mesos-containerizer-and-universal-container-runtime for a valid example on how to run a Docker image with the Mesos UCR.
{
"id": "mesos-docker",
"container": {
"docker": {
"image": "mesosphere/inky"
},
"type": "MESOS"
},
"args": ["hello"],
"cpus": 0.2,
"mem": 16.0,
"instances": 1
}
You'll need Marathon >= 1.3.0 and Mesos >= 1.0 for that.

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?

marathon docker jobs hanged in deployment state

Hi I have been successfull so far with simple jobs in marathon but it stuck when i have tried deploying a deocker job in mesos through marathon framework.
I am using a json file as below to deploy a docker job:
{
"id": "pga-docker",
"cpus": 0.2,
"mem": 1024.0,
"instances": 1,
"container": {
"type": "DOCKER",
"docker": {
"image": "pga",
"network": "BRIDGE",
"portMappings": [
{ "containerPort": 80, "hostPort": 6565, "servicePort": 0, "protocol": "tcp" }
]
}
}
}
My pga docker image have no problem when run as container, but through marathon its just not working. Its staying in the deploying state forever.
I am using the below command line:
curl -X POST http://10.141.141.10:8080/v2/apps -d #basic-3.json -H "Content-type: application/json"
But when I run the same image from marathon UI, its working. To run from marathon I used "docker run --publish 6060:80 --name test --rm pga" in the cmd field of the UI new job page.
Any one have idea why this is hanged in the command line approach?
This is what i have found during some trial and error with the json file.
I found that when we run docker image in local system, if we have mentioned an entry point or a cmd then that will execute while running the container. But this is not same for mesos/marathon. my observation is that if I explicitly mentioned cmd in the deployment json then its working fine.
"cmd":"sh pga-setup.sh"
I will love to know if anyone faced a similar issue an solved it by another way.

Mesos cannot deploy container from private Docker registry

I have a private Docker registry that is accessible at https://docker.somedomain.com (over standard port 443 not 5000). My infrastructure includes a set up of Mesosphere, which have docker containerizer enabled. I'm am trying to deploy a specific container to a Mesos slave via Marathon; however, this always fails with Mesos failing the task almost immediately with no data in stderr and stdout of that sandbox.
I tried deploying from an image from the standard Docker Registry and it appears to work fine. I'm having trouble figuring out what is wrong. My private Docker registry does not require password authentication (turned off for debugging this), AND if I shell into the Meso's slave instance, and sudo su as root, I can run a 'docker pull docker.somedomain.com/services/myapp' successfully every time.
Here is my Marathon post data for starting the task:
{
"id": "myapp",
"cpus": 0.5,
"mem": 64.0,
"instances": 1,
"container": {
"type": "DOCKER",
"docker": {
"image": "docker.somedomain.com/services/myapp:2",
"network": "BRIDGE",
"portMappings": [
{ "containerPort": 7000, "hostPort": 0, "servicePort": 0, "protocol": "tcp" }
]
},
"volumes": [
{
"containerPath": "application.yml",
"hostPath": "/var/myapp/application.yml",
"mode": "RO"
}
]
},
"healthChecks": [
{
"protocol": "HTTP",
"portIndex": 0,
"path": "/",
"gracePeriodSeconds": 5,
"intervalSeconds": 20,
"maxConsecutiveFailures": 3
}
]
}
I've been stuck on this for almost a day now, everything I've tried seems to be yielding the same result. Any insights on this would be much appreciated.
My versions:
Mesos: 0.22.1
Marathon: 0.8.2
Docker: 1.6.2
So this turns out to be an issue with volumes
"volumes": [
{
"containerPath": "/application.yml",
"hostPath": "/var/myapp/application.yml",
"mode": "RO"
}
]
Using the root path of the container of the root path may be legal in docker, but Mesos appears not to handle this behavior. Modifying the containerPath to a non-root path resolves this, i.e
"volumes": [
{
"containerPath": "/var",
"hostPath": "/var/myapp",
"mode": "RW"
}
]
If it is a problem between Marathon and the registry, the answer should be in the http logs of your registry. If Marathon connects, there will be an entry. And the Mesos master log should contain a clue as well.
It doesn't really sound like a problem between Marathon and Registry though. Are you sure you have 'docker,mesos' in /etc/mesos-slave/containerizers?
Did you --despite having no authentification-- try to follow Using a Private Docker Repository?
To supply credentials to pull from a private repository, add a .dockercfg to the uris field of your app. The $HOME environment variable will then be set to the same value as $MESOS_SANDBOX so Docker can automatically pick up the config file.

Resources