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.
Related
After pruning with the command "docker system prune -a" nodejs wont build anymore beacuse trix.css is missing. I am assuming this was probably deleted while pruning. How can I resolve this error (see the error below)? Why is it not created again while building the container again since the file is in the docker file.
Required path doesn't exist: /code/bower_components/trix/dist/trix.css trix
[13:57:39] 'vendorcss' errored after 1.63 ms
[13:57:39] Error: Promise rejected without Error
at Domain.onError (/usr/local/lib/node_modules/gulp/node_modules/async-done/index.js:49:15)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Domain.emit (events.js:211:7)
at Domain._errorHandler (domain.js:134:21)
at process._fatalException (bootstrap_node.js:375:33)
[13:57:39] 'staging' errored after 41 ms
ERROR: Service 'nodejs' failed to build: The command '/bin/sh -c gulp staging' returned a non-
zero code: 1
Usually I use this command : "sudo docker-compose -f docker-compose-staging.yml build nodejs" when I want to build the container again. I am very new to this and would be greatfull for some help.
For me, this was the case:
The issue exists because trix.css was removed in the latest version. It has nothing to do with docker system prune as far as I understand.
You can compare the two versions here: https://github.com/basecamp/trix/compare/1.3.1...v2.0.0
Basically, in order to fix this issue, you need to do
yarn install
yarn build
inside bower_components. This is suggested in the official updated README of the trix repository: https://github.com/basecamp/trix.
Once done with that, you will have trix.css and trix.umd.min.js files for your perusal.
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'
I have a problem and hope someone can help me. I am currently trying to write a script for Termux or Termux:Task. My script currently looks like this:
#!/data/data/com.termux/files/usr/bin/bash
cd /./sdcard/www/public/
wp post list sleep 5
Every time I load the script I get the following error message:
/data/data/com.termux/files/usr/bin/wp: /usr/bin/env: bad interpreter: No such file or directory.
I've been looking for a solution to my problem for hours, unfortunately without success.
I am using an extension for Termux called "WordPress CLI". When I start termux and enter the commands individually, everything works. But as soon as I write the commands into a sh script and start it doesn't work anymore. :(
Can anyone help me?
Thanks a lot
This is simple error you can fix it by replacing !/data/data/com.termux/files/usr/bin/bash. With #!/data/data/com.termux/files/usr/bin/bash
Please tell if you get error again
Try with #!/usr/bin/env bash in the shebang line.
Termux-exec allows you to execute scripts with shebangs for traditional Unix file structures. So shebangs like #!/bin/sh and #!/usr/bin/env python should be able to run without termux-fix-shebang.
From https://wiki.termux.com/wiki/Termux-exec
According to doc:
Why do I keep getting a '/bin/sh bad interpreter' error?
This error is thrown due to access script interpreter at nonexistent
location.
Termux does not have common directories like /bin, /sbin, /usr/bin at
their standard place. There is an exception for certain devices where
/bin is a symbolic link to /system/bin, but that does not make a
difference.
Interpreters should be accessed at this directory only:
/data/data/com.termux/files/usr/bin
There are three ways to fix this:
Install termux-exec by using pkg install termux-exec. It won’t affect the current session, but after a restart should work without
any setup. Not needed if your Termux is up to date. If still not
working, try the next workaround.
Use command termux-fix-shebang to fix the shebang line of specified file.
Use termux-chroot from package proot to setup a chroot environment mimicking a normal Linux file system in Termux.
termux-fix-shebang my_script.py of second method work for me, which it modify the shebang(first line of my_script.py) from #!/usr/bin/env python to #!/data/data/com.termux/files/usr/bin/env python. Since /usr/bin/ is not exist in Android, that's why it throws the error /usr/bin/env: bad interpreter: No such file or directory. The other solution is run with python my_script.py, neither of my_script.py nor ./my_script.py.
In my test, termux-exec of the first method only work if I added correct shebang in main script(child OR child of child script no need) and ran command export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so.
And for the issue of this question, error shows /usr/bin/env in the middle with /data/data/com.termux/files/usr/bin/wp even though the shebang of script #!/data/data/com.termux/files/usr/bin/bash looks ok, it means that wp command (located at /data/data/com.termux/files/usr/bin/wp) used inside the script contains shebang #!/usr/bin/env wp and should modify it to #!/data/data/com.termux/files/usr/bin/env wp too. termux-exec of first method should fix this specific case too(already has correct shebang in main script).
I have created a Django REST framework project that I want to deploy on a server. I do not have admin access to the server, and so, the only way I found to ensure that all the project dependencies (such as Anaconda distribution) will be available on the server, is to create a docker image for my project , then create a corresponding container on the server, then run it from there.
In my project, I have a python script (mymain.py) that gets called using subprocess.Popen().
This works fine locally, and subprocess.Popen() does everything it is supposed to do.
However, when I try to do it from the docker container, it seems as if the line subprocess.Popen() was completely skipped [mymain.py is not called].
For docker, I have created a docker-compose.yml file, and in command prompt I type:
docker-compose up
I do not see any error, and everything seem to be working fine, however subprocess.Popen() does not seem to be working.
mymain.py first line is:
print('Testing if subprocess called mymain.py!!!')
In a different file, I call subprocess.Popen().
I tried printing out the error, but unfortunately, both stdout and stderr return nothing:
p = subprocess.Popen(['python', mymain_path, args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out, err = p.communicate()
print('SUBPROCESS ERROR: ' + str(err))
print('SUBPROCESS stdout: ' + str(out.decode()))
And this is what I get:
SUBPROCESS ERROR: None
SUBPROCESS stdout:
As you can see, the first line of my main.py was never printed...
However, when I do this locally by typing in command prompt:
python manage.py runserver 9000
everything works with no issues (the line 'Testing if subprocess called mymain.py!!!' gets printed).
I even tried to open the docker container shell and type the same 'python manage.py runserver 9000' command in there, but that did not work unfortunately.
Now the question is, how do I get subprocess to work remotely (in a docker container)?
Any help on this is very appreciated!
I am using:
Docker version 18.09.2, build 6247962
docker-compose version 1.23.2, build 1110ad01
Python 3.7.0
Looks like a way to get rid of this issue is to:
1. use 'shell=False'
2. Not have a return value for the 'subprocess.Popen()'
subprocess.Popen(['python', mymain_path, args], shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
Had exactly the same problem, none of previous fixes worked for me.
Finally I tried
print("Hello world!", flush=True)
which seems to work in my environment (docker, python3.7)
I just installed the Bitnami DjangoStack and want to know how to create a new project in Windows.
I tried opening the python.exe (similar to command prompt) and tried typing in:
django-admin.py startproject testproject
which is what all the articles seem to say to start with.
I am getting an invalid syntax error. I'm assuming I'm missing something very basic?
Thanks!
You need to run django-admin.py from the command prompt.
The Python interactive interpreter (what you get when you open up python.exe) is for typing in Python code and running it line by line. If you want to run Python code that is in a file, you need to run it from command prompt.
Note that if that doesn't work, you might need to put python before it, and you also might need no specify the full path (usually something like python C:/Python27/Scripts/django-admin.py, assuming you're on Python 2.7.)