I am biginner in block chain development. I tried to hyperledger composer in multiple host. I successfully running ./startfabric.sh.
Then I tried to run ./createpeerAdmincard.sh
But I got an error message that no valid response from any peer. I changed many time composer vertion 0.16 to 0.19.x. And I tried to delete .composer file in home directory. But my problem is not solved. Please give a solution as possible.
Os is : Ubuntu 16.04
Hyperledger composer is:1.0.4
Thanks
Before anything, I would run these commands in the directory which has ./startFabric.sh to uninstall previous versions of your CLI / remove all cards or credentials you may have generated up to this point.
$ npm uninstall -g composer-rest-server
$ rm -rf ~/.composer
$ rm *.card
$ rm -rf credentials/
(optional - kill docker containers)
$ docker kill $(docker ps -q)
$ docker rm $(docker ps -aq)
$ docker rmi $(docker images -q)
now run
./downloadFabric.sh
and then after
./startFabric.sh
Now, install composer and composer-rest-server (version 19.5) ** this is very important.
npm install -g composer-cli#0.19.5
and then
npm install -g composer-rest-server#0.19.5
and then, after all that, try and use ./createPeerAdminCard.sh
I find this tutorial pretty useful to get up and running with Composer -> https://github.com/IBM/BlockchainNetwork-CompositeJourney#1-starting-hyperledger-fabric
Related
I suddenly got the fatal error message from Docker yesterday. I really don't understand why as I shut down my machine properly. So I decided to uninstall docker and reinstall it. I went into the Applications folder in my Mac and I can't uninstall because it thinks the docker is open. So I need help with the following:
how do I uninstall docker?
how do I install it so it can start working again?
Attempts at a resolution:
Just tried the following command in my terminal:
docker kill $(docker ps -q)
I got the following response:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
"docker kill" requires at least 1 argument.
See 'docker kill --help'.
What do I do?
See the screen shot
This was getting me crazy.
You don't need to reinstall Docker to solve it. The workaround (at least in my case) is as simple as killing all Docker related processes and running Docker again:
$ pkill Docker
$ open -a /Applications/Docker.app
1- open Activity monitor and go to com.docker. process , from there you have to kill it to proceed further.
2- uninstall from mac is standard procedure.
In my case I was not able to use the Option of Rest and Diagnose too. UI was completely hung
Here's how I solved it.
Killed the docker process $ pkill Docker
Moved the docker application to bin
Manually deleted all the below files
sudo rm -rf /usr/local/lib/Docker
sudo rm -rf /Library/PrivilegedHelperTools/com.docker.vmnetd
sudo rm -rf /Library/LaunchDaemons/com.docker.vmnetd.plist
rm -rf ~/.docker
rm -rf ~/Library/Containers/com.docker.docker
rm -rf ~/Library/Application Support/Docker Desktop
rm -rf ~/Library/Preferences/com.docker.docker.plist
rm -rf ~/Library/Saved Application State/com.electron.docker-frontend.savedState
rm -rf ~/Library/Group Containers/group.com.docker
rm -rf ~/Library/Logs/Docker Desktop
rm -rf ~/Library/Preferences/com.electron.docker-frontend.plist
rm -rf ~/Library/Cookies/com.docker.docker.binarycookies
Restarted the laptop
Installed the latest version again which worked fine
Ok, I was able to fix this problem. You can do this with ANY application (just change the name), that you can't remove from the applications folder.
It will remove the entire application in its entirety. The existence of the application is wiped clean.
Please do the following commands in this order
ps aux | grep docker
When you run this command you get a big display. You are only interested in the following thing in the his screen grab
2 Then do a sudo kill command that includes the number in the red box from the ps aux|grep command as shown this code example in step 1.
sudo kill -9 108
Finally go to sudo remove command specifying the specific folder and application you want to remove.
sudo rm -rf /Applications/Docker.app/
Restart your machine.
Install version of docker. If the error occurred when updating to a new version of docker (such as in my case). You can download an older version of docker from here (the older version numbers are listed in the far left). I chose 3.3.0 (released 04/21 installed 6/11/21
Note:
If you have a problem installing an older version of docker and you encounter a problem
Run the following command and you will see a .json display
vi ~/Library/"Group Containers"/group.com.docker/settings.json
Scroll down to settings and modify the version down. For 3.3.0 I went down to setting version 7.
Restart docker and when it opens check images and you can see your containers
It worked for me when I opened the terminal and then ran this:
killall Docker && cd /Applications;open -a Docker;cd ~
I found it here: https://www.lewuathe.com/how-to-deal-with-failed-to-ping-backend-api-in-docker.html
I'm facing this error for docker version 3.6.0. then reinstall docker version 4.1.1 and it's working fine.
When I run docker stop $(docker ps -a -q) to stop all Docker containers. It works fine. It stops all running containers.
But if I add to an NPM script, like:
package.json
"scripts": {
"docker:stop-all": "docker:stop-all": "docker stop $(docker ps -a -q)"
}
And I run: npm run docker:stop-all
I'm getting this error:
> docker stop $(docker ps -a -q)
unknown shorthand flag: 'a' in -a
See 'docker stop --help'.
How can I execute that stop-all command by using an NPM script?
Just found out what was the problem.
When you call npm run, npm itself will run a shell to run those instructions.
And that shell should be able to understand the instructions.
If npm calls PowerShell (on Windows), for example, it will not understand $(docker ps -a -q) since it's a Bash specific instruction.
So you need to config npm so it will execute bash or git-bash instead of Windows cmd or PowerShell.
I found out how to set that config on this question.
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
You can list your npm configs to check that it worked:
npm config ls
I have a local Dockerfile, with:
FROM webdevops/php-apache:7.2
.....
I added some lines in the Dockerfile and build it locally:
docker build -t webdevops/php-apache:7.3
Now I wan to use the 7.3 version of Docker container.
I am using Docksal (https://docksal.io/) to bring this container and other 3 containers up.
so would this work? and when I execute command $fin up on Mac terminal.
it will automatically look for version 7.3 of this container tag, and use it? or do I have to do anything additional?
Just want to confirm, if I don't have to change the:
FROM webdevops/php-apache:7.2
to
webdevops/php-apache:7.3
Which, in this case would look locally for version 7.3 and use that instead of 7.2 in the registry.
Adding steps and error results for clarity:
appending the following in Dockerfiles
ADD BCPSG.cer /etc/ssl/certs
RUN update-ca-certificates
run the command: $docker build -t webdevops/php-apache:7.3 .
Error:
No releases available for package "pecl.php.net/mcrypt"
install failed
The command '/bin/sh -c pecl install mcrypt-1.0.1' returned a non-zero code: 1
possible fix:
FROM php:7.2
RUN apt-get update \
&& apt-get install -y libmcrypt-dev \
&& rm -rf /var/lib/apt/lists/* \
&& pecl install mcrypt-1.0.1 \
&& docker-php-ext-enable mcrypt
yes it will work you can remove this container and add new container using this docker files. which you have newly created.
Docker ps
Find particular container name or tag assign to particular container
Docker rm "containername"
you can also delete all containers using
Docker rm $(docker ps -aq)
and after deleting old containers add the new container.
Docker run -d -p port:containerport imagename:tag
I want to install docker inside a running docker container.
docker run -it centos:centos7
My base container is using centos, I can login to running container using docker exec. But when I try to install docker inside it using yum install -y docker it installs.
But somehow I can't start the docker service with docker -d &, it gives me error as:
INFO[0000] Option DefaultNetwork: bridge
WARN[0000] Running modprobe bridge nf_nat br_netfilter failed with message: , error: exit status 1
FATA[0000] Error starting daemon: Error initializing network controller: Error initializing bridge driver: Setup IP forwarding failed: open /proc/sys/net/ipv4/ip_forward: read-only file system
Is there a way I can install docker inside docker container or build image already having running docker? I have already seen these examples but none works for me.
The output of uname -r on the host machine:
[fedora# ~]$ uname -r
4.2.6-200.fc22.x86_64
Any help would be appreciated.
Thanks in advance
Update
Thanks to https://stackoverflow.com/a/38016704/372019 I want to show another approach.
Instead of mounting the host's docker binary, you should copy or install a container specific release of the docker binary. Since you're only using it in a client mode, you won't need to install it as a system service. You still need to mount the Docker socket into the container so that you can easily communicate with the host's Docker engine.
Assuming that you got a base image with a working Docker binary (e.g. the official docker image), the example now looks like this:
docker run\
-v /var/run/docker.sock:/var/run/docker.sock\
docker:1.12 docker info
Without actually answering your question I'd suggest you to read Using Docker-in-Docker for your CI or testing environment? Think twice.
It explains why running docker-in-docker should be replaced with a setup where Docker containers run as siblings of the "outer" or "base" container. The article also links to the original https://github.com/jpetazzo/dind project where you can find working examples how to run Docker in Docker - in case you still want to have docker-in-docker.
An example how to enable a container to access the host's Docker daemon look like this:
docker run\
-v /var/run/docker.sock:/var/run/docker.sock\
-v /usr/bin/docker:/usr/bin/docker\
busybox:latest /usr/bin/docker info
If you are on Mac with Docker toolbox.
The below command WON’T WORK
docker run\
-v /var/run/docker.sock:/var/run/docker.sock\
-v /usr/bin/docker:/usr/bin/docker\
busybox:latest /usr/bin/docker info
Because /var/run/docker.sock will not be on your OSX filesystem
the Docker daemon is running inside the boot2docker VM - and that's where the unix socket is.
So you have to run the container from boot2docker VM
$ docker-machine ssh default
$ docker run\
-v /var/run/docker.sock:/var/run/docker.sock\
-v $(which docker):/usr/bin/docker\
busybox:latest /usr/bin/docker info
$ exit
This looks like Docker-in-Docker, feels like Docker-in-Docker, but it’s not Docker-in-Docker, when this container will create more containers, those containers will be created in the top-level Docker.
You need the --privileged parameter.
By default, Docker containers are “unprivileged” and cannot, for
example, run a Docker daemon inside a Docker container.
Source
Run your base image with the command docker run --privileged -it centos:centos7 bash. Then you may install and run another docker container inside that container.
I`ve a similar problems in my vms.
I`ve solve the problem with change the storage file system from image to vfs(in daemon.json file)
like the image bellow
For image works first create a base image, in my case with centos7
FROM centos:7
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]
with this image builded (in my case i called local/c7-systemd) create a second image, installing docker and moving daemon.json to inside.
FROM local/c7-systemd
RUN yum install -y yum-utils
RUN yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
RUN yum install -y docker-ce docker-ce-cli containerd.io
RUN curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
RUN chmod +x /usr/local/bin/docker-compose
RUN ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
COPY daemon.json /etc/docker/daemon.json
RUN yum install -y nano
RUN systemctl enable docker
EXPOSE 80
EXPOSE 8080
EXPOSE 8161
EXPOSE 6379
EXPOSE 8761
CMD ["/usr/sbin/init"]
enjoy!
I have successfully installed docker-machine on my Windows computer, and I'm able to use the Docker CLI on my windows box to run docker commands on a boot2docker VM.
I have docker-machine version 0.2.0, and docker 1.6.2, and the VM yields "4.0.3-boot2docker" when I run "uname -r" on it.
Now I want to install docker-compose to manage that boot2docker VM. Does docker-compose run on my Windows machine and manage the VM "remotely", as docker does, or do I have to install it on the VM itself?
On a related note, I tried installing docker-compose on my VM by doing the following:
C:\ docker-machine ssh dev
$ whoami
docker
$ sudo -i
# curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# exit
$ which docker
/usr/local/bin/docker
$ which docker-compose
/usr/local/bin/docker-compose
This is fine, but when I try to run docker-compose it doesn't work.
$ docker-compose up
-sh: docker-compose: not found
The file is in /usr/local/bin, and it has exactly the same privileges as docker.
docker#dev:/usr/local/bin$ ls -al do*
-rwxr-xr-x 1 root root 15443675 May 13 21:24 docker
-rwxr-xr-x 1 root root 5263681 May 19 00:09 docker-compose
docker#dev:/usr/local/bin$
Is there something I'm missing?
Have a good look at the curl output. It seems that the download url is not valid anymore. I found that
curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-Linux-x86_x64
gave
{"error":"Not Found"}
For me, the current release 1.3.2 worked well, i.e.:
curl -L https://github.com/docker/compose/releases/download/1.3.2/docker-compose-Linux-x86_x64
NOTE: When using on current CoreOS don't try to output in /usr/local/bin/docker-compose as noted here. Instead use /opt/bin/docker-compose (dir may need to be created first), i.e.
mkdir -p /opt/bin
curl -L https://github.com/docker/compose/releases/download/1.3.2/docker-compose-Linux-x86_x64 > /opt/bin/docker-compose
I found that the download links don't work for older versions and the "install" fails silently resulting in the problem you describe. Have a look to find a download link to a current version here:
https://github.com/docker/compose/releases
Like mkoertgen said, you can always view the output from the curl command in the terminal to see that you don't get "not found" or something similar or run cat /usr/local/bin/docker-compose to verify that it's not a textfile containing "not found".
You can install docker-compose on your Windows host too.
It will manage your docker remotely. You can think of docker-compose as a more abstract interface to docker.
After running boot2docker init, run boot2docker shellinit | Invoke-Expression. This will tell docker and docker-compose where the docker server is running.
More info on installing it on Windows can be found here: http://docs.docker.com/installation/windows/