Version error when launching hyperledger composer rest server docker - docker

A little background: I have a business network running on IBM cloud hyperledger starter edition. It's built with composer v0.19.14, and as far as I can tell, everything is v0.19.14 and should work with Fabric v1.1. I can deploy my BNA and view with composer playground and even launch composer-rest-server from my machine locally and everything looks good. But when I try to launch my docker composer rest server, I get a version compatibility error. I've searched everywhere and tried all the recommendations out there, but to no avail.
Here is the error when launching the docker in -it mode:
Error: Error trying to ping. Error: Composer runtime (0.19.14) is not compatible with client (0.19.12)
Here's my Dockerfile:
FROM hyperledger/composer-rest-server:0.19.14
Here's my build script:
docker build -t hyperledger/composer-rest-server:0.19.14 .
source envvars_simple.txt
docker run \
-it \
-e COMPOSER_CARD=${COMPOSER_CARD} \
-e COMPOSER_NAMESPACES=${COMPOSER_NAMESPACES} \
-e COMPOSER_AUTHENTICATION=${COMPOSER_AUTHENTICATION} \
-e COMPOSER_MULTIUSER=${COMPOSER_MULTIUSER} \
-e COMPOSER_APIKEY=${COMPOSER_APIKEY} \
-v ~/.composer:/home/composer/.composer \
--name rest \
-p 3001:3000 \
sample/sample-hyperledger-rest-server

I think the error is in the first line
docker build -t hyperledger/composer-rest-server:0.19.12 .
You are pulling down a composer-rest-server based docker image with v0.19.12 where the remainder of your components are 0.19.14. Try pulling the same version of the container and it should be ok.

I'm a dummy. So the problem was that docker run kept trying to pull an old image from docker hub called sample/sample-hyperledger-rest-server that i created, but didn't bother to update. This is a simple case of my bad.

Related

How do I use local elrond docker container node for local smart-contract development

I am new to elrond. I (think) successfully have local node running in docker?
Both of these yield same log output in portainer:
sudo docker run -d \
--name my-elrond-testnet \
-v ${PATH_TO_BLS_KEY_FILE}:/data/ \
elrondnetwork/elrond-go-node:latest \
--nodes-setup-file="/data/nodesSetup.json" \
--p2p-config="/data/config/p2p.toml" \
--validator-key-pem-file="/data/keys/validatorKey.pem"
sudo docker run -d \
--name my-other-elrond-testnet \
--mount type=bind,source=${PATH_TO_BLS_KEY_FILE}/,destination=/data \
elrondnetwork/elrond-go-node:latest \
--validator-key-pem-file="/data/validatorKey.pem"
But now I dont know what to do. How do I connect to that local node.
I wanted to use it as a local development node - I want to deploy smart contracts on it.
I have some experience with Solana and with NEAR.
I dont see that the container exposes any ports.
Do I need a proxy?
This isn't docker but it successfully runs a local node(s).
https://docs.elrond.com/developers/setup-local-testnet/
I followed most of the instructions without an issue except that when I tried to run "erdpy" it failed.
But elsewhere I found " pip install erdpy"
Once you get erdpy working, the rest of the instructions went well, as far as getting a local node(s) to run.
I dont know yet about actually deploying a contract on it.
There's also this: https://docs.elrond.com/developers/setup-local-testnet-advanced/

How to show GUI apps from docker desktop container on windows 11

From this article, it states that windows 11 natively supports running of X11 and wayland applications on wsl.
I tried to do the same through a docker container, settinng the environment variable DISPLAY="host.docker.internal:0.0", and running a gui application (like gedit). But instead I got this error:
Unable to init server: Could not connect: Connection refused
Gtk-WARNING **: 17:05:50.416: cannot open display: host.docker.internal:0.0
I stumbled upon your question while attempting the same thing as you are and acctually got it to work with aid of this blog post on Microsoft. I use a minimal Dockerfile based on Ubuntu and installs gedit:
FROM ubuntu:22.04
RUN apt update -y && apt install -y gedit
CMD ["gedit"]
Create the image the usual way, e.g. docker build . -t guitest:1.0
On the WSL command line, start it like this:
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix \
-v /mnt/wslg:/mnt/wslg \
-e DISPLAY \
-e WAYLAND_DISPLAY \
-e XDG_RUNTIME_DIR \
-e PULSE_SERVER \
guitest:1.0
I hope this is to good use for you as well.
This answer is heavily based on what chrillof has said. Thanks for the excellent start!
The critical things here for Docker Desktop users on Windows with WSL2 are that:
The container host (i.e. docker-desktop-data WSL2 distribution) does not have a /tmp/.X11-unix itself. This folder is actually found in the /mnt/host/wslg/.X11-unix folder on the docker-desktop distribution which translates to /run/desktop/mnt/host/wslg/.X11-unix when running containers.
There are no baked-in environment variables to assist you, so you need to specify the environment variables explicitly with these folders in mind.
I found this GitHub issue where someone had to manually set environment variables which allowed me to connect the dots between what others experience directly on WSL2 and chrillof's solution
Therefore, modifying chrillof's solution using PowerShell from the host, it looks more like:
docker run -it -v /run/desktop/mnt/host/wslg/.X11-unix:/tmp/.X11-unix `
-v /run/desktop/mnt/host/wslg:/mnt/wslg `
-e DISPLAY=:0 `
-e WAYLAND_DISPLAY=wayland-0 `
-e XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir `
-e PULSE_SERVER=/mnt/wslg/PulseServer `
guitest:1.0
On my computer, it looks like
this (demo of WSLg X11)
To be clear, I have not checked if audio is functional or not, but this does allow you to avoid the installation of another X11 server if you already have WSL2 installed.

docker: Error response from daemon: invalid volume specification

I'm currently following this tutorial to run a model on Docker that was built using the Google Cloud AutoML Vision:
https://cloud.google.com/vision/automl/docs/containers-gcs-tutorial
I'm having trouble running the container, specifically running this command:
sudo docker run --rm --name ${CONTAINER_NAME} -p ${PORT}:8501 -v ${YOUR_MODEL_PATH}:/tmp/mounted_model/0001 -t ${CPU_DOCKER_GCR_PATH}
I have my environment variables set up right (did an echo $<env_var>). I do not have a /tmp/mounted_model/0001 directory on my local system. My model path is configured to be the model location on the cloud storage.
${YOUR_MODEL_PATH} must be a directory on the host on which you're running the container.
Your question suggests that you're using the Cloud Storage bucket path but you cannot do this.
Reviewing the tutorial, I think the instructions are confusing.
You are told to:
gsutil cp \
${YOUR_MODEL_PATH} \
${YOUR_LOCAL_MODEL_PATH}/saved_model.pb
So, your command should probably be:
sudo docker run \
--rm \
--interactive --tty \
--name=${CONTAINER_NAME} \
--publish=${PORT}:8501 \
--volume=${YOUR_LOCAL_MODEL_PATH}:/tmp/mounted_model/0001 \
${CPU_DOCKER_GCR_PATH}
NB I added --interactive --tty to make debugging easier; it's optional
NB ${YOUR_LOCAL_MODEL_PATH} not ${YOUR_MODEL_PATH}
NB The command should not be -t ${CPU_DOCKER_GCR_PATH} omit the -t
I've not run through this tutorial.

Install CI gitlab with Docker in Windows

Trying to install a gitlab runner on my windows machine inside a docker container
Using
docker run -d --name gitlab-runner --restart always \ -v ${PWD}/gitla
/gitlab-runner \ -v /var/run/docker.sock:/var/run/docker.sock \ gitlab/gitlab-runner:latest
I'm following the official docs but nothing refers to windows
https://docs.gitlab.com/runner/install/docker.html
What's the correct way to set-up a docker container to execute a gitlab runner?
Thanks in advance!
It currently isn't fully supported, however there is an open issue and relevant open merge request to add that functionality!

Docker invalid characters for volume when using relative paths

Ive been given a docker container which is run via a bash script. The container should set up a php web app, it then goes on to call other scripts and containers. It seems to work fine for others, but for me its throwing an error.
This is the code
sudo docker run -d \
--name eluci \
-v ./config/eluci.settings:/mnt/eluci.settings \
-v ./config/elucid.log4j.settings.xml:/mnt/eluci.log4j.settings.xml \
--link eluci-database:eluci-database \
/opt/eluci/run_eluci.sh
This is the error
docker: Error response from daemon: create ./config/eluci.settings:
"./config/eluci.settings" includes invalid characters for a local
volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to
pass a host directory, use absolute path.
Im running docker on a centos VM using virtualbox on a windows 7 host.
From googling it seems to be something to do with the mount, however I dont want to change it in case the setting it breaks or is relied upon in another docker container. I still have a few more bash scripts to run, which should orchestrate the rest of the build process. As a complete newb to Docker, this has got me stumped.
The command docker run -v /path/to/dir does not accept relative paths, you should provide an absolute path. The command can be re-written as:
sudo docker run -d \
--name eluci \
-v "/$(pwd)/config/eluci.settings:/mnt/eluci.settings" \
-v "/$(pwd)/config/elucid.log4j.settings.xml:/mnt/eluci.log4j.settings.xml" \
--link eluci-database:eluci-database \
/opt/eluci/run_eluci.sh

Resources