I have launched QuestDB through this way:
docker run -p 9000:9000 --memory="100g" --name docker_questdb -v questdb/questdb
After uncommenting the following line in the server.conf:
cairo.sql.copy.root=
Then running the import command:
COPY d1temp FROM '/home/user/d1_data/d1.csv'
would generate the following error:
QuestDB could not open file [errno=2, path=/home/user/d1_data/d1.csv]
However, the file actually exists:
less /home/user/d1_data/d1.csv
s0,s1,s2
0.093684,0.601416,0.020954
0.181069,0.323754,0.624349
0.665080,0.735986,0.346020
0.317661,0.295168,0.540372
0.702641,0.381416,0.251456
0.056244,0.428558,0.985173
0.893521,0.018625,0.100640
Could this solved please? In the meantime, how could this be fixed?
Os errno=2 is 'No such file or directory'.
If path you specified is outside the container then you need to make sure it's shared via -v. It's best to enter the container and check that file exists inside (e.g. with docker exec) .
Lastly - the path used in copy command is not absolute but relative to cairo.sql.copy.root so if cairo.sql.copy.root is set to '/home/user/d1_data/' then command should look like :
COPY d1temp FROM 'd1.csv'
Related
My docker file looks like this:
WORKDIR $BUILD_OUTPUT_DIR
ENV TEMPLATECONF=$BUILD_INPUT_DIR/$PROJECT/sources/meta-$PROJECT/custom
COPY prep.sh /home/$USER_NAME/yocto/input/
COPY fetch-repos.sh /home/$USER_NAME/yocto/input/
USER root
RUN chmod +x /home/$USER_NAME/yocto/input/prep.sh
RUN chmod +x /home/$USER_NAME/yocto/input/fetch-repos.sh
RUN ls -l /home/$USER_NAME/yocto/input/*.sh
CMD ["sh","-c", "./home/$USER_NAME/yocto/input/prep.sh && bitbake $PROJECT"]
I run the container like this in azure ACR:
- task: Docker#2
inputs:
containerRegistry: '2460-ACR-connection-TMM'
command: 'login'
- script: |
docker run 2460testacr.azurecr.io/2460testacr.2460testacr.azurecr.io:$(tag)
But I have got this error, would you help?
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/cce02da3-0534-40a8-81c5-52ed45134050.sh
sh: ./home/rtr2460/yocto/input/prep.sh: No such file or directory
./root/prep.sh: No such file or directory
Tells you that the file at that location does not exist or the user has no access rights to that location. You will need to find the exact location where this path is being assumed in your configuration tries to use this path. It is either legitimate or not.
If it is legitimate, then there are two possibilities: it is either missing or your user does not have the necessary privileges.
If it is a privilege problem, then you can add a line that adds the necessary privileges. Otherwise, if it is missing, then you will need to find out why it is missing. Chances are that your
COPY prep.sh /home/$USER_NAME/yocto/input/
line is copying the file to the wrong location.
Otherwise, if it is illegitimate, then there is a bug in your configuration (that you can find by searching for anything related to this filename) and fix it.
I would like to build a custom Docker file. I start with Ubuntu
FROM ubuntu
But I would also like to add buildpack-deps:stretch
I understand that I am only allowed to use FROM once, so short of copying the contents of buildpack-deps:stretch into my Docker file, how do I add it to my Docker file?
AFAIK, simply "including" another Dockerfile does not work. But, you actually are allowed to use multiple FROM statements, if you use multistage builds (cf. the Docker docs).
For example, you could do something like this:
FROM buildpack-deps:stretch AS build
RUN echo "hello world!" > /tmp/foo
FROM ubuntu
COPY --from=build /tmp/foo .
CMD ["cat", "foo"]
Running docker build --tag foo . && docker run --rm foo results in hello world!. You could replace the first RUN statement with the compilation of something or whatever you are planning to do.
There are more ways for using multistage builds, e.g. using FROM build in our example directly.
So I've got a docker file like so:
FROM frolvlad/alpine-python2
MAINTAINER *REDACTED*
COPY . .
RUN pip install -r requirements.txt
RUN python misc_scripts/gen_hosts.py
RUN python misc_scripts/strip_delims.py
RUN python runparse.py -spc -spi
ENTRYPOINT ["python", "rebuild.py"]
And using the Docker API in python I'm trying to run the container like so
logs = client.containers.run(image_id, name=str(_uuid), entrypoint=['-m ME3400', '-mi NONE'])
However I get the following error
500 Server Error: Internal Server Error ("OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"-m ME3400\": executable file not found in $PATH": unknown")
I assume I'm doing it wrong, anyone know how/why this isn't working?
As you said in the title of your question, it should be the command argument you expect. Follow the source code on github(starting line 484), it should be more specific.
Change your code as below:
logs = client.containers.run(image_id, name=str(_uuid), command=['-m ME3400', '-mi NONE'])
Always note that CMD will treat as ENTRYPOINT's args when it exists. But if you specify another ENTRYPOINT(in your case: ['-m ME3400', '-mi NONE']), the original one(["python", "rebuild.py"]) will be overwritten.
I'm having trouble running a .sh file in python. When I type in the location of the .sh file (/home/pi/file/script.sh) the script runs perfectly.
I'm trying to run this script in my python2 script and I've done the following methods:
subprocess.Popen(['bash', 'location of .sh'])
subprocess.call(['location of .sh'])
os.popen(['location of .sh'])
When I run the python script, I get a prompt from rclone saying "Command sync needs 2 arguments maximum"
My .sh file just includes:
#!/bin/sh
sudo /usr/local/bin/rclone -v sync /home/pi/some_project_data remote:rclone --delete-before --include *.csv --include *.py
I'm not sure how running the .sh file on terminal works fine, but this error pops up when I'm trying to run the .sh file using Python.
Your script fails whenever you run it in a directory containing 2 or more .csv or .py files. This is true for terminals as well as via Python.
To avoid that, quote your patterns so the shell doesn't expand them:
#!/bin/sh
sudo /usr/local/bin/rclone -v sync /home/pi/some_project_data remote:rclone \
--delete-before --include "*.csv" --include "*.py"
Please try:
os.popen('bash locationof.sh')
ex:
os.popen('bash /home/script.sh')
That worked on my machine. If you place square brackets around the string then python assumes it is a list and popen doesnt accept a list, it accepts a single string.
If the script doesnt work, then this won't fix that, but it will at least run it. If it still doesnt work, try running the script with something like
touch z.txt
and see if z.txt appears in the file explorer. If it does, then your .sh file has a problem.
I created this file ex1.py and saved it in the Python27 file which is on my C drive. I'm trying to run this file in the command prompt. On my command prompt by default it is set for PS C:\Users\Ted. Next I changed the path so that it was reflective of where the file is actually located and this is the error message I got "A positional parameter cannot be found that accepts argument ex1.py"
As per Anthony Forloney's comment:
... you do not need the PS before the C:\Python27\python argument. Also, you may not even need to provide the path to your python.exe if C:\Python27 is defined appropriately as your PATH environment variable. In any event, try: C:\Python27\python C:\directory\where\ex1.py
I found by changing the directory path to where the file was stored worked. So the syntax I used was cd C:\Python 27. Once I was in that directory I could then run the file.