fabric up the network failed - docker

When I execute the command ./byfn.sh -m up
The following error occurs:
Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
docker: Cannot connect to the Docker daemon at tcp://127.0.0.1:4243. Is the docker daemon running?.
See 'docker run --help'.
LOCAL_VERSION=1.1.0-rc1
DOCKER_IMAGE_VERSION=
=================== WARNING ===================
Local fabric binaries and docker images are
out of sync. This may cause problems.
===============================================
ERROR: Couldn't connect to Docker daemon. You might need to start Docker for Mac.
ERROR !!!! Unable to start network

Fetch bootstrap.sh from fabric repository using
curl -sS https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh -o ./scripts/bootstrap.sh
Change file mode to executable
chmod +x ./scripts/bootstrap.sh
Download binaries and docker images
./scripts/bootstrap.sh [version]

You have to re-sync the docker images first:
fabric-samples/scripts$ sudo ./fabric-preload.sh
Make sure you have the right version set in the script. In your case VERSION=1.1.0-rc1

you have to give the permission, try
sudo ./byfn.sh -m up

This message caused from your Docker Daemon since it not started yet, please start your docker first.

You are trying to use diiferent versions of the Fabric and the Docker images.

you can update the yum and docker's version,use:yum update,and url of docker:https://docs.docker.com/install/linux/docker-ce/centos/

Related

Failed to connect to bus: Host is down in ubuntu

"sudo systemctl enable --now docker" while running this command I'm getting an error like "System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down"
How can I fix this and I'm new to Ubuntu commands.
Please refer to Latest Docker Documentation; Older versions of Docker don't play nicely.
The trick is to uninstall sudo apt-get remove docker docker.io containderd, etc... And add the docker GPG key and setup the repository (documented in link). Then install sudo apt-get install docker-ce docker-ce-cli containerd.io instead.
Once you've removed old docker from your Ubuntu installation, you can then go sudo service docker start to have docker daemon running without systemctl and use service instead.
I am using ubuntu:20.04 Image.
I encountered the same error while trying to use systemctl command inside the ubuntu docker container, since the system has not been booted with systemd as init system (PID 1) as the error says so in order to fix that you will need to start you container using this
docker run -ti -d ubuntu:20.04 "/sbin/init"
In fact, running the container will cause an error:
I have solvedcontroller_1 | Failed to mount tmpfs at /run: Operation not permitted
container_1 | Failed to mount tmpfs at /run/lock: Operation not permitted
container_1 | [!!!!!!] Failed to mount API filesystems.
container_1 | Freezing execution.
By default, the container is not authorized to access any device, but a container with a "privileged" tag grants its root capabilities to all devices on the host system that will give access to the container to mount API filesystems and solve the issue.
in order to fix that you will need to
docker run -ti -d --privileged ubuntu:20.04 "/sbin/init"

Failed to get D-Bus connection: Operation not permitted

I'm trying to install ambari 2.6 on a docker centos7 image but in the the ambari setup step and exactly while initializing the postgresql db I receive this error:
Failed to get D-Bus connection: Operation not permitted
I've got this error every time I try to run a service on my docker image.
I tried every solution in the net but nothing worked yet.
Does any one have an idea how to resolve this ?
Thank you in advance
Use this command
docker run -d -it --privileged {Image ID} /usr/sbin/init
And access root in container
systemctl start httpd.service
This should work!
On Centos7 all the services are started and stopped throught the systemd daemon. The systemctl command will simply try to talk to the daemon by using a d-bus channel - and that's where the message comes from.
Instead of running a container in priviledged mode (so it is not really contained) you could also try out the docker-systemctl-replacement to avoid the situation.
To elaborate on #Guido's answer, what worked for me was copying systemctl.py from here and placing it in the same directory as my Dockerfile, and then adding the following to my Dockerfile:
COPY systemctl.py /usr/bin/systemctl
RUN chmod a+x /usr/bin/systemctl
E.g., this allowed me to start an sshd service like so:
service sshd start
Run this command:
docker run -it -p 1001:25 --name postfix1 --privileged -d --cap-add=SYS_ADMIN -v /sys/fs/cgroup:/sys/fs/cgroup:ro postfix

service docker start fails (daemon is not a docker command)

I have a problem after I have tried to restart docker. Since then,
service docker start returns "start: Job failed to start".
This may have started once I have changed docker.conf. I have tried to reupload it using the command
wget -O /etc/init/docker.conf https://raw.githubusercontent.com/docker/docker/master/contrib/init/upstart/docker.conf
however, I was not lucky to fix this.
cat /var/log/upstart/docker.log returns:
Waiting for /var/run/docker.sock
docker: 'daemon' is not a docker command. See 'docker --help'.
Waiting for /var/run/docker.sock
docker: 'daemon' is not a docker command. See 'docker --help'.
Waiting for /var/run/docker.sock
docker: 'daemon' is not a docker command. See 'docker --help'.
Any help would be really appreciated.
You likely have an old version of docker installed; the docker daemon subcommand was added in docker 1.8. Before that, the daemon was started using the -d / --daemon option (docker -d).
The version of the upstart-configuration you downloaded is intended for the current docker release; for older versions of docker, be sure to download the version that matches the version you've installed, for example;
https://raw.githubusercontent.com/docker/docker/v1.7.1/contrib/init/upstart/docker.conf
I would suggest to upgrade to a more recent version of docker, because versions older than 1.8 are now getting quite old (in Docker terms)
In my case, after upgrade to docker 19.03.5, I got this error.
When starting manually the /usr/bin/dockerd all works but via systemctl start docker it fails.
Looking at journalctl -xe I found the log:
docker: 'daemon' is not a docker command.
But the docker.service file was right, starting /usr/bin/dockerd.
I spent a time to figure out that the previous installation had a configuration file in: /etc/systemd/system/docker.service.d/override.conf that replace the docker daemon start command(/usr/bin/dockerd) with other deprecated syntax.
In this case you can remove the override.conf file to allow docker start:
rm /etc/systemd/system/docker.service.d/override.conf
systemctl daemon-reload
systemctl start docker
Hope it helps

Docker TLS Error on Ubuntu

I am trying to learn about Docker in ubuntu 15.04.
When i give any command using docker like "docker info", it arise following error:
FATA[0000] Post http:///var/run/docker.sock/v1.17/containers/create: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
I don't understand what does it mean.
Somebody help me to fix this error.Thanks
If you are using boot2docker and its running, this should solve your problem
eval "$(boot2docker shellinit)"
Is docker running?
service docker.io restart
Are you running as root?
sudo docker info
Are the Env variables set?
env | grep DOCKER
DOCKER_HOST=tcp://.....:2376
DOCKER_TLS_VERIFY=1
DOCKER_CERT_PATH=/.....
I ran into this issue a little bit ago when trying to follow some of the original Ubuntu installation instructions and was unable to start the docker service.
I ran the following to install the latest of docker:
wget -qO- https://get.docker.com/gpg |sudo apt-key add -
curl -sSL https://get.docker.com/ubuntu | sudo sh
sudo apt-get update
Then after adding my local user to the docker group and rebooting, I still hit the Daemon TLS error.
Investigating the service it appeared to be masked and I tried unmasking it, but it still wouldn't work until I also unmasked docker.socket as well and enabled the service with the following commands:
sudo systemctl unmask docker.service
sudo systemctl unmask docker.socket
sudo systemctl enable docker.service
Found the answer to the last piece here in case any of you hit this problem as well:
https://groups.google.com/forum/#!topic/docker-user/3Sou7Umo0SA

docker error: /var/run/docker.sock: no such file or directory

I am new to docker. I have a shell script that loads data into impala and I want a docker file that runs builds an image and run the container.
I am on mac, installed boot2docker and have the DOCKER_HOST env set up.
bash-3.2$ docker info
Containers: 0
Images: 0
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Dirs: 0
Execution Driver: native-0.2
Kernel Version: 3.15.3-tinycore64
Debug mode (server): true
Debug mode (client): false
Fds: 10
Goroutines: 10
EventsListeners: 0
Init Path: /usr/local/bin/docker
Sockets: [unix:///var/run/docker.sock tcp://0.0.0.0:2375]
I am trying to just installed a pre-built image using:
sudo docker pull busybox
I get this error:
sudo docker pull busybox
2014/08/18 17:56:19 Post http:///var/run/docker.sock/images/create?fromImage=busybox&tag=: dial unix /var/run/docker.sock: no such file or directory
Is something wrong with my docker setup?
When I do a docker pull busybox, It pulls the image and download is complete.
bash-3.2$ docker pull busybox
Pulling repository busybox
a9eb17255234: Download complete
fd5373b3d938: Download complete
d200959a3e91: Download complete
37fca75d01ff: Download complete
511136ea3c5a: Download complete
42eed7f1bf2a: Download complete
c120b7cab0b0: Download complete
f06b02872d52: Download complete
120e218dd395: Download complete
1f5049b3536e: Download complete
bash-3.2$ docker run busybox /bin/echo Hello Doctor
Hello Doctor
Am I missing something?
You don't need to run any docker commands as sudo when you're using boot2docker as every command passed into the boot2docker VM runs as root by default.
You're seeing the error when you're running as sudo because sudo doesn't have the DOCKER_HOST env set, only your user does.
You can confirm this by doing a:
$ env
Then a
$ sudo env
And looking for DOCKER_HOST in each output.
As for having a docker file that runs your script, something like this might work for you:
Dockerfile
FROM busybox
# Copy your script into the docker image
ADD /path/to/your/script.sh /usr/local/bin/script.sh
# Run your script
CMD /usr/local/bin/script.sh
Then you can run:
docker build -t your-image-name:your-tag .
This will build your docker image, which you can see by doing a:
docker images
Then, to run your container, you can do a:
docker run your-image-name:your-tag
This run command will start a container from the image you created with your Dockerfile and your build command and then it will finish once your script.sh has finished executing.
You can quickly setup your environment using shellinit
At your command prompt execute:
$(boot2docker shellinit)
That will populate and export the environment variables and initialize other features.
docker pull will fail if docker service is not running. Make sure it is running by
:~$ ps aux | grep docker
root 18745 1.7 0.9 284104 13976 ? Ssl 21:19 0:01 /usr/bin/docker -d
If it is not running, you can start it by
sudo service docker start
For Ubuntu 15 and above use
sudo systemctl start docker
On my MAC when I start boot2docker-vm on the terminal using
boot2docker start
I see the following
To connect the Docker client to the Docker daemon, please set:
export DOCKER_CERT_PATH=<my things>
export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://<ip>:2376
After setting these environment variables I was able to run the build without the problem.
Update [2016-04-28] If you are using a the recent versions of docker you can do
eval $(docker-machine env) will set the environment
(docker-machine env will print the export statements)
I also got this error. Though, I did not use boot2docker but just installed "plain" docker on Ubuntu (see https://docs.docker.com/installation/ubuntulinux/).
I got the error ("dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?") because the docker daemon was not running, yet.
On Ubuntu, you need to start the service:
sudo service docker start
See also http://blog.arungupta.me/resolve-dial-unix-docker-sock-error-techtip64
For boot2docker on Windows, after seeing:
FATA[0000] Get http:///var/run/docker.sock/v1.18/version:
dial unix /var/run/docker.sock: no such file or directory.
Are you trying to connect to a TLS-enabled daemon without TLS?
All I did was:
boot2docker start
boot2docker shellinit
That generated:
export DOCKER_CERT_PATH=C:\Users\vonc\.boot2docker\certs\boot2docker-vm
export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://192.168.59.103:2376
Finally:
boot2docker ssh
And docker works again
In Linux, first of all execute sudo service docker start in terminal.
If you're using CentOS 7, and you've installed Docker via yum, don't forget to run:
$ sudo systemctl start docker
$ sudo systemctl enable docker
This will start the server, as well as re-start it automatically on boot.
To setup your environment and to keep it for the future sessions you can do:
echo 'export DOCKER_HOST="tcp://$(boot2docker ip 2>/dev/null):2375";' >> ~/.bashrc
Then:
source ~/.bashrc
And your environment will be setup in every session
The first /var/run/docker.sock refers to the same path in your boot2docker virtual machine. Correcly write for windows /var/run/docker.sock
You, maybe the not the OP, but someone may have a directory called /var/run/docker.sock/ already due to how many times you hack and slash to get things right with docker (especially noobs). Delete that directory and try again.
This helped me on my way to getting it to work on Centos 7.
I have installed the docker using offline method and post server restart docker is not running.
So, I executed the below command it worked for me!
/usr/bin/dockerd > /dev/null
run the following commands, OS = CentOS / RHLE / Amazon Linux, etc.
sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl status docker
chmod 777 /var/run/docker.sock

Resources