Installed jq in Docker Container - permission denied - json

I first installed jq for PowerShell using chocolatey (worked) but wasn't able to access it within my running docker container.
Therefore I installed jq in the Docker container via the command I found under this stackexchange-link.
curl -L -o /usr/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
When I am now trying to access jq for example with the command jq --version it says /bin/sh: 1: jq: permission denied
How am I able to access jq within the Docker-Terminal?

You must make the file executable before you can execute it:
chmod u+x /usr/bin/jq

Related

Getting error running "podman unshare chown"

I'm trying to run a mysql container with a persistent volume but when I run the command below I got an error guiding to use unshare with rootless:
$podman unshare chown 27:27 -R /home/user1/tmp
Error: please use unshare with rootless
It has been solved using mount option :Z
$ podman run container -v /local/dir:/container/dir:Z -d image:latest

Is it possible to pass a determined $MYSQL_ROOT_PASS to MySQL docker from outside docker? If so how?

So I'm writing an install script and because I haven't been able to find a solid MySQL replacement on armfh (the db must be MySQL compatible), I'm using a community on that works, however it does not initiate the db as it should. it requires me to pass the following argument.
mysql -h"db" -u"root" -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" < /docker-entrypoint-initdb.d/1_db.sql
From inside the docker. Problem is I want this to flow naturally as a smooth install script. I've tried using the following command to pass the document and get a password prompt:
docker exec -it db bash -c "mysql -h"db" -u"root" -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" < /docker-entrypoint-initdb.d/1_db.sql"
If also tried:
docker exec -it db bash -c "mysql -h'db' -u'root' -p'$MYSQL_ROOT_PASSWORD' '$MYSQL_DATABASE' < /docker-entrypoint-initdb.d/1_db.sql
FwIW: I used the MYSQL_ROOT_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) to define the password. And if I manually enter the docker send command 1 (in quotations) the db initiates.
So to summarize my question: Is it possible to pass a command like the above to activate the 1_db.sql file from outside docker?
Any help would be amazing! Thanks in advance!
Is it possible to pass a command like the above to activate the
1_db.sql file from outside docker?
you can try something like
cat 1_db.sql | docker exec -i test bash -c 'mysql -uroot -p$MYSQL_ROOT_PASSWORD $MYSQL_DATABASE'
also, remember when you try exec bash -c "mysql -uroot -p$MYSQL_ROOT_PASSWORD"it will for MYSQL_ROOT_PASSWORD in the host, not inside container, use single quotes.
determined $MYSQL_ROOT_PASS to MySQL docker from outside docker? If so
how?
docker exec -i test bash -c 'echo mysql docker password is $MYSQL_ROOT_PASSWORD'

Installing gogs persistent on minishift

I'm trying to install gogs on minishift with persistentVolumes.
I did this:
c:\> oc login -u system -p admin
c:\> oc new-project cicd
c:\> oc create -f https://raw.githubusercontent.com/OpenShiftDemos/gogs-openshift-docker/master/openshift/gogs-persistent-template.yaml
from the webconsole I load and execute the imported yaml template and I have gogs and postgresql up and running as you can see in the image below
Unfortunately, when I try to do this first installation of gogs I stuck in this error:
I know the issue is that gogs docker can access in write mode on /etc/gogs/conf/ dir.
How can I solve this on minishift?
thx
fabrizio

Openshift: how to edit scc non-interactively?

I am experimenting with openshift/minishift, I find myself having to run:
oc edit scc privileged
and add:
- system:serviceaccount:default:router
So I can expose the pods. Is there a way to do it in a script?
I know oc adm have some command for policy manipulation but I can't figure out how to add this line.
You can achieve it using oc patch command and with type json. The snippet below will add a new item to array before 0th element. You can try it out with a fake "bla" value etc.
oc patch scc privileged --type=json -p '[{"op": "add", "path": "/users/0", "value":"system:serviceaccount:default:router"}]'
The --type=json will interpret the provided patch as jsonpatch operation. Unfortunately oc patch --help doesn't provide any example for json patch type. Luckily example usage can be found in kubernetes docs: kubectl patch
I have found an example piping to sed Here and adapted it to ruby so I can easily edit the data structure.
oc get scc privileged -o json |\
ruby -rjson -e 'i = JSON.load(STDIN.read); i["users"].push "system:serviceaccount:default:router"; puts i.to_json ' |\
oc replace scc -f -
Here is quick and dirty script to get started with minishift
The easiest way to add and remove users to SCCs from the command line is using the oc adm policy commands:
oc adm policy add-scc-to-user <scc_name> <user_name>
For more info, see this section.
So for your specific use-case, it would be:
oc adm policy add-scc-to-user privileged system:serviceaccount:default:router
I'm surprised its needed though. I use "oc cluster up" normally, but testing with recent minishift, its already added out of the box:
$ minishift start
$ eval $(minishift oc-env)
$ oc login -u system:admin
$ oc get scc privileged -o yaml | grep system:serviceaccount:default:router
- system:serviceaccount:default:router
$ minishift version
minishift v1.14.0+1ec5877
$ oc version
openshift v3.7.1+a8deba5-34

Solace VMR Installation through Command Line using virtual-install

I am trying to install solacevmr on centOS 7 through command line. The solace docs give a guide to install solaceVMR through GUI only - Guide
The command I am using is:
virt-install --name solacekvm --ram 4096 --cpu host --arch x86_64 --vcpu 2 --virt-type qemu --disk path={path to cow image} --force --network bridge:virbr0 --connect qemu:///system --nographics --import
But I am not sure if this the correct command to execute; and on executing this command I get the following error logs in virt-viewer console.
The error trace
Your virt-install command is valid.
The error trace indicates that the VM instance is unable to mount the file system. Please verify that the qcow2 image that you've downloaded is not corrupt.
The md5sum of soltr-8.0.0.102-vmr-evaluation.qcow2.xz is c1afcb8ced0c6ecadd4d0ebec521486d.
The md5sums of other VMR variants can be found over at http://dev.solace.com/downloads/