Unable to copy the file to docker host - docker

I am trying to execute the below docker command where I am trying to get the 'Orthanc.json" file to my system folder which is "orthanc".
docker run --rm --entrypoint=cat jodogne/orthanc /etc/orthanc/orthanc.json >
orthanc/orthanc.json
under /etc/orthanc/orthanc.json - It is a directory and not a file - Am not able to use vim editor to read/open the file. - This is a public one. Anyone can access using this link Orthanc link
I get the below error message, Can you please help me understand what is the issue?
-bash: /orthanc/orthanc.json: Is a directory
orthanc.json should be a file but why does it treat it as a directory?
when I use vim orthanc.json, it throws an error message that it's a directory.
What should I be doing to see this as a config file as I have to make changes to it?

You've somehow already got a directory named /orthanc/orthanc.json on your host system. Remove it and try again.
rmdir /orthanc/orthanc.json # if empty
rm -rf /orthanc/orthanc.json # if not empty -- but see what's in there first!

Related

Getting "No such file or directory/" error while running command in docker

I am trying to load the database as part of the image creation using dockerfile. At the end, I am trying to load the data to the mysql database by adding a shell file as part of the docker entry point.
COPY ./scripts/initdb.sh /docker-entrypoint-initdb.d/
the initdb.sh has the following content
mysql -u root -p<root_password> <database_name> < /data/dump.sql
The problem is when the file is executed I am getting the following error:
: No such file or directory/initdb.sh: line 1: /data/dump.sql
I have checked the following
the files exists in the correct directory
the permission are proper (-rwxr-xr-x)
changed the permission thru RUN chmod +x /docker-entrypoint-initdb.d/*.sh
but, nothing seems to be working, am sure there is a something simple I am missing.

How to access my file system from a dockered pgadmin4

I tried to install pgadmin4 on my system in several ways, but each time I was defeated by the intricacies of the install. Luckily I discovered a Dockerfile (dpage/pgadmin4) and that worked out of the box. In my docker-compose.yml I added a volume statement
volumes:
- /var/lib/pgadmin4:/var/lib/pgadmin
In order to preserve the pgadmin data over successive runs. pgadmin4 is accessible from 0.0.0.0:5050 and all works fine.
However, I cannot access the files from my local file system with the query tool, this is all hidden in the docker file system. Fortunately that is in the /var/lib/pgadmin4 system on my local machine. In that directory there is a directory storage and that contains the id I use to login as the name of a directory: the ID x#y.z becomes directory x_y.z and that contains the files and folders I had created from my browser as a test. I tried to change this in the pgadmin4 options to /home/user/development but that path is not recognized because it is not in x_y.z.
Question: how can I change pgadmin4's path from /var/lib/pgadmin4/storage/x_y.z into /home/user/development?
Update
I tried to link a part of my home directory into /var/lib/pgadmin4/storage/x_y.z as a symbolic link:
sudo ln -s /home/user/Documents
After that command there exists a linked directory /var/lib/pgadmin4/storage/x_y.z/Documents with uid:gid being root:root and 777 permission. When I next start the query toolbox and click at open the open box appears and I get 4 identical error messages:
Error: [Errno 2] No such file or directory: /var/lib/pgadmin4/storage/x_y.z/Documents
I have changed the owner:group to the relevant ones I could think of:
1000:1000 (me as user)
root:root
5050:5050 (pgadmin uid and gid)
In all three cases I got this error. What is wrong here?
You override paths in config_local.py (you can create it if not exists already).
STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
to
STORAGE_DIR = '/home/user/Documents'
Restart pgAdmin4.
Ref: https://www.pgadmin.org/docs/pgadmin4/4.22/config_py.html

-bash: cd: supbot-tut: No such file or directory

I opened terminal fresh and typed.
$ python3
Then I typed quit to get out of it.
$ quit()
I then typed:
$ pip3 install splinter requests bs4
After I typed:
$ cd supbot-tut
-bash: cd: supbot-tut: No such file or directory
When I typed that I got the error code: -bash: cd: supbot-tut: No such file or directory.
I tried this dozens of times and it won't work. I do not know how to fix this problem and I am a new coder so please send exact code I have to write to fix this problem. Thank you!
Check if you're in the correct directory using pwd and see if that directory contains supbot-tut that you're trying to get into with ls.
Or you can make a directory using mkdir supbot-tut then you will be able to cd into it.
That error occurs when you try to issue the cd command and you pass a directory (a folder) that doesn't exist. Can you type the command ls and see if you see that directory listed. You can easily check with your file explorer too. Create that directory and your issue should go away.

Docker ADD giving error "No source files were specified"

Dockerfile is failing on the following line:
ADD ./test-web-app/build/libs/test-web*.war /app/test-web.war
Error Step 8/29 : COPY ./test-web-app/build/libs/test-web*.war
/app/micro-service.war No source files were specified
This is the first time I am working on Docker builds. How do I debug this issue? Is there a way to echo if the host file is existing by a command ?
be sure that the path of the file is accessible where the Dockerfile is. When you run the build, the . folder is where the Dockerfile is. So you directory structure has to be something similar to this:
.
..
Dockerfile
test-web-app (folder)
To be sure that the war file is accessible try to list the file (on your host machine) for example.
$ ls ./test-web-app/build/libs/test-web*.war

docker cp not working

I'm following this tutorial and when I get to the part where I call:
cp /tf_files/stripped_retrained_graph.pb bazel-bin/tensorflow/examples/android/assets/stripped_output_graph.pb
and
cp /tf_files/retrained_labels.txt bin/tensorflow/examples/android/assets/imagenet_comp_graph_label_strings.txt
They both say "No such file or directory".
As you can see in this image I can cd to the tf_files folder and see that the files are there.
I can also cd to /tensorflow/tensorflow/examples/android/assets and call ls which shows there's just a BUILD file there.
In the cp command is there supposed to already be a stripped_output_graph.pb file in the destination which gets replaced? Or is it meant to just be creating a new file there?
Is there some way of doing cp [source] [current directory] rather than specifying the destination as a path?
I've tried removing the file path part in hope that it just uses the source filename but that doesn't work.
Calling
cp /tf_files/stripped_retrained_graph.pb /tensorflow/tensorflow/examples/android/assets/stripped_output_graph.pb
and
cp /tf_files/retrained_labels.txt /tensorflow/tensorflow/examples/android/assets/imagenet_comp_graph_label_strings.txt
finally worked, wasn’t at all obvious that I’d have to change the destination path or what it should be though.
Also I accidentally saved a file as .p rather than .pb but managed to remove it using $ docker exec <container> rm -rf /tensorflow/tensorflow/examples/android/asset
s/stripped_output_graph.p
Now I managed to copy the files in correctly, but then when I installed the app it was still just running the regular demo app.
Not sure why it didn’t work, so frustrating.
When I rebuilt it after copying the files in I got these conflict messages
Are these normal to have?
It looks like maybe a different labels file is taking priority over mine, how can I reach the external/inception5h/imagenet_comp_graph_label_strings.txt file to delete it so my file is used instead?
Does the “external” part mean that I can’t actually access it?

Resources