How can I initialize `libdc1394` on Docker - macos

I'm having an error with Docker libdc1394 error: Failed to initialize libdc1394.
I'm following the tutorial to run openalpr on Docker (bottom of the page).
tmp $curl -O http://plates.openalpr.com/h786poj.jpg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 62721 100 62721 0 0 91248 0 --:--:-- --:--:-- --:--:-- 91164
tmp $ls
Atom Crashes ctr-105095629 ctr-503179909 h786poj.jpg
com.apple.launchd.0ukBh0eylN ctr-216276841 ctr-689085399
com.apple.launchd.KkrRGe2BZO ctr-379945785 ctr-860639129
tmp $docker run -it --rm -v $(pwd):/data:ro openalpr -c eu h786poj.jpg
libdc1394 error: Failed to initialize libdc1394
Image file not found: h786poj.jpg
How can I initialize libdc1394 on Docker

If You add -v /dev/null:/dev/raw1394 to docker - Seem's this fixes your problem
docker run -it --rm -v $(pwd):/data:ro -v /dev/null:/dev/raw1394 openalpr -c eu h786poj.jpg

Related

docker-compose gives "ERROR: No such container" in mac sometimes

I have 2 containers bind with docker-compose and when I run 'docker-compose' sometimes I get below error. But after few minutes when I do the same command this will work without any error.
command:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
error:
ERROR: No such container: fc372eac40b072da029f4933317f184d0ca8b791970b505d3577d404f7d561ca
docker ps -a :
e34f8caed8c9 "docker-entrypoint.s…"
fc372eac40b0 "docker-entrypoint.s…"

installing docker-compose using standard procedure gives "permission denied"

I have done this many times but this is new.
Just following the docker-compose install from docker.com
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 633 100 633 0 0 2082 0 --:--:-- --:--:-- --:--:-- 2075
100 12.1M 100 12.1M 0 0 5940k 0 0:00:02 0:00:02 --:--:-- 10.8M
sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
-bash: /usr/local/bin/docker-compose: Permission denied
What is going wrong here ? It used to work before.

Why can't a Bash script handle space and dash on Linux subsystem for Windows?

I'm running a Linux subsystem on a Windows 10 machine. I wrote a script to download the latest build from a Jenkins server, renamed it, and saved it on the Onedrive mapped in Windows. The problem is those spaces and the dash in the path are not handled well when running the script.
The script is the one below:
#!/bin/bash
path=$(echo "OneDrive - Atos")
echo $path
echo "/mnt/c/Users/A474998/$xpath/"
filename=$(echo "\"/mnt/c/Users/A474998/$path/___Software/SIP_CP100.img\"")
echo $filename
curl http://jenkins.devices-dev.global-intra.net/view/mainline/job/we1_cp100_sip_arm_nightly/lastStableBuild/artifact/vobs/Opera_Build/Nightly/SIP/WP_LO_CP100/cruise/opera_bind.SIP.WP_LO.nand.img --output $filename
This is the output when I run the script
bokos#DESKTOP-DLETB9D:~$ ./testget
OneDrive - Atos
/mnt/c/Users/A474998//
"/mnt/c/Users/A474998/OneDrive - Atos/___Software/SIP_CP100.img"
curl: option -: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
I run this script in debug mode and this is the output
bokos#DESKTOP-DLETB9D:~$ sh -x ./testget
+ echo OneDrive - Atos
+ path=OneDrive - Atos
+ echo OneDrive - Atos
OneDrive - Atos
+ echo /mnt/c/Users/A474998//
/mnt/c/Users/A474998//
+ echo "/mnt/c/Users/A474998/OneDrive - Atos/___Software/SIP_CP100.img"
+ filename="/mnt/c/Users/A474998/OneDrive - Atos/___Software/SIP_CP100.img"
+ echo "/mnt/c/Users/A474998/OneDrive - Atos/___Software/SIP_CP100.img"
"/mnt/c/Users/A474998/OneDrive - Atos/___Software/SIP_CP100.img"
+ curl http://jenkins.devices-dev.global-intra.net/view/mainline/job/we1_cp100_sip_arm_nightly/lastStableBuild/artifact/vobs/Opera_Build/Nightly/SIP/WP_LO_CP100/cruise/opera_bind.SIP.WP_LO.nand.img --output "/mnt/c/Users/A474998/OneDrive - Atos/___Software/SIP_CP100.img"
curl: option -: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
If I manually run the command from the debug mode I can download the file and save it in the correct Onedrive location
bokos#DESKTOP-DLETB9D:~$ curl http://jenkins.devices-dev.global-intra.net/view/mainline/job/we1_cp100_sip_arm_nightly/lastStableBuild/artifact/vobs/Opera_Build/Nightly/SIP/WP_LO_CP100/cruise/opera_bind.SIP.WP_LO.nand.img --output "/mnt/c/Users/A474998/OneDrive - Atos/___Software/SIP_CP100.img"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 22.2M 100 22.2M 0 0 747k 0 0:00:30 0:00:30 --:--:-- 470k
I then copy this command in a script
#!/bin/bash
curl http://jenkins.devices-dev.global-intra.net/view/mainline/job/we1_cp100_sip_arm_nightly/lastStableBuild/artifact/vobs/Opera_Build/Nightly/SIP/WP_LO_CP100/cruise/opera_bind.SIP.WP_LO.nand.img --output "/mnt/c/Users/A474998/OneDrive - Atos/___Software/SIP_CP100.img"
and when I execute it, the file will be downloaded and saved in the correct location
bokos#DESKTOP-DLETB9D:~$ ./testget
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 22.2M 100 22.2M 0 0 790k 0 0:00:28 0:00:28 --:--:-- 868k
I have tried lots of combinations with
" " ' ' ``
I cannot rename the path of Onedrive to remove space and dash.
So I m really confused and I don't know what I m doing wrong.
Any help will be appreciated. Thank you for your time in advance.

Heroku: "heroku ps:exec" not working when deploying a container into a dyno

I'm deploying a Tensorflow Serving container to Heroku, everything is working fine, but when I try to ssh into the container for executing some commands, Heroku returns this error:
C:\Users\whitm\Desktop\CodeProjects\deep-deblurring-serving>heroku ps:exec
Establishing credentials... error
! Could not connect to dyno!
! Check if the dyno is running with `heroku ps'
The Dyno is running correctly:
C:\Users\whitm\Desktop\CodeProjects\deep-deblurring-serving>heroku ps
Free dyno hours quota remaining this month: 550h 0m (100%)
Free dyno usage for this app: 0h 0m (0%)
For more information on dyno sleeping and how to upgrade, see:
https://devcenter.heroku.com/articles/dyno-sleeping
=== web (Free): /bin/sh -c bash\ heroku-exec.sh (1)
web.1: up 2020/04/11 19:13:51 -0400 (~ 38s ago)
I found a StackOverflow question from two years ago: Shell into a Docker container running on a Heroku dyno. How?. I already take care of all the details explained on the question, and the official Heroku docs about this specific situation: https://devcenter.heroku.com/articles/exec#using-with-docker, but I'm can't make this working.
This is my Dockerfile:
FROM tensorflow/serving
LABEL maintainer="Whitman Bohorquez" description="Build tf serving based image. This repo must be used as build context"
COPY / /
RUN apt-get update \
&& apt-get install -y git \
&& git reset --hard \
&& apt-get install -y curl \
&& apt-get install -y openssh-server
ENV MODEL_NAME=deblurrer
# Updates listening ports
RUN echo '#!/bin/bash \n\n\
tensorflow_model_server \
--rest_api_port=$PORT \
--model_name=${MODEL_NAME} \
--model_base_path=/models/${MODEL_NAME} \
"$#"' > /usr/bin/tf_serving_entrypoint.sh \
&& chmod +x /usr/bin/tf_serving_entrypoint.sh
# Setup symbolic link from sh to bash
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
CMD bash heroku-exec.sh
Special care in the line RUN rm /bin/sh && ln -s /bin/bash /bin/sh. Im installing Curl, OpenSSH, Python already in the container. I create the file heroku-exec.sh with [ -z "$SSH_CLIENT" ] && source <(curl --fail --retry 3 -sSL "$HEROKU_EXEC_URL") inside it, and successfully copy it into the /app/.profile.d folder, that is, the final route of the file is /app/.profile.d/heroku-exec.sh. Inclusive I tried do the last step as if the container is in a Heroku Private Space (that is not the case) but I will remove that.
Don't know what else to try, hope some help, I feel I'm doing something wrong with the heroku-exec.sh file, but what you think?
Thanks in advance!

"docker run" dies after exiting a bash shell script

I'm attempting to craft system admin bash tools for starting up a Docker image.
But such docker run keeps dying on me after its bash script exited.
The actual working bash script in question is:
#!/bin/sh
docker run \
--name publicnginx1 \
-v /var/www:/usr/share/nginx/html:ro \
-v /var/nginx/conf:/etc/nginx:ro \
--rm \
-p 80 \
-p 443 \
-d \
nginx
docker ps
Executing the simple script resulted in:
# ./docker-run-nginx.sh
743a6eaa33f435e3e0d211c4047bc9af4d4667dc31cd249e481850f40f848c83
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
743a6eaa33f4 nginx "nginx -g 'daemon of…" 1 second ago Up Less than a second 0.0.0.0:32778->80/tcp, 0.0.0.0:32777->443/tcp publicnginx1
And after that bash script gets completed, I executed 'docker ps'
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
There is no Docker running.
What did I do wrong?
Try to run it without --rm.
You can see all container (including the one that already died using this command):
> docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS
743a6eaa33f4 nginx "nginx -g 'daemon of…" 1 second ago Exited (??) ??
^^^^^
You should be able to look at what is the exit code of the container. Using the container id, you can also look into it's log to understand better what is going on:
docker logs 743a6eaa33f4
If you still can't figure it out, you can start the container with tty to run bash, and try to run the command inside it.
docker run -it -v /var/www:/usr/share/nginx/html:ro -v /var/nginx/conf:/etc/nginx:ro --rm -p 80 -p 443 nginx bash

Resources