I'm tinkering with Docker where I'm using:
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
RUN chmod +x /usr/src/app/entrypoint.sh
Strangely, I'm getting error saying "no such file or directory" but
it is there.
when I call docker-compose -f docker-compose-dev.yml up -d --build
command I get this output:
Successfully built 36461c09191a
Successfully tagged testdriven-app_users:latest
testdriven-app_users-db_1 is up-to-date
Recreating testdriven-app_users_1 ... error
ERROR: for testdriven-app_users_1 Cannot start service users: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": stat /usr/src/app/entrypoint.sh: no such file or directory": unknown
ERROR: for users Cannot start service users: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": stat /usr/src/app/entrypoint.sh: no such file or directory": unknown
ERROR: Encountered errors while bringing up the project.
What can I try to resolve this ?
The error is thrown since you are trying to copy your file in a folder which does not exist in the filesystem, and that folder is : entrypoint.sh
You must change your COPY command to :
COPY ./entrypoint.sh /usr/src/app
Your destination path is a folder therefore it must not include the name of your file.
Related
My kubectl cp isnt working due to tar not being in my bin folder of my container. I can't seem to find how to get it installed.
I get an error when trying:
kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir
Error:
rpc error: code = 2 desc = oci runtime error: exec failed:
container_linux.go:235: starting container process caused "exec:
"tar": executable file not found in $PATH"
It looks like there is no Tar into your Docker
I would suggest installing the Tar first at the above Dockerfile level commands
You can add the Tar into Docker using
Docker image : RUN yum install -y tar
I am getting the following error while taking mongodb backup from docker container using shell script. I am giving the error below.
container name : uBot_sandbox_subhrajp
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"mongodump\": executable file not found in $PATH": unknown
Error: No such container:path: uBot_sandbox_subhrajp:/data/ubot-db-mongobackup_2021_02_09_13-09-58
My shell script is given below.
#!/bin/bash
export DATABASE_NAME="ubot-db"
export BACKUP_LOCATION="/home/UBOT"
export TIMESTAMP=$(date +'%Y_%m_%d_%H-%M-%S')
for NAMES in $(docker ps -a --format "{{.Names}}" --filter "name=uBot_sandbox");do
echo "container name : $NAMES"
docker exec -t ${NAMES} mongodump --out /data/${DATABASE_NAME}-mongobackup_${TIMESTAMP} --db ${DATABASE_NAME}
docker cp ${NAMES}:/data/${DATABASE_NAME}-mongobackup_${TIMESTAMP} ${BACKUP_LOCATION}
done
Here I need to take mongodb backup from all matched containers and copy those into target location. Please help me to resolve this error and execute the code as expected.
I want to build an image and I have already build my Dockerfile .I already have the container ,but the image is difficult for me to buiold it .this is code for Dockerfile:
FROM nginx:alpine
COPY . /usr/share/nginx/html
But the problem is , I tried to run it on my terminal (I am using MacBook Terminal) with this command.This code what I wrote in the terminal :
Build an image from a Dockerfile
tiadem_tatie#SIT-SMBP1606 ~ % docker run -p 80:80 countly_new
Unable to find image 'countly_new:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.
tiadem_tatie#SIT-SMBP1606 ~ % docker build -t Countly_new .
invalid argument "Countly_new" for "-t, --tag" flag: invalid reference format: repository name must be lowercase
See 'docker build --help'.
tiadem_tatie#SIT-SMBP1606 ~ % docker build -t COUNTLY_NEW .
invalid argument "COUNTLY_NEW" for "-t, --tag" flag: invalid reference format: repository name must be lowercase
See 'docker build --help'.
tiadem_tatie#SIT-SMBP1606 ~ % docker build -t countlynew .
error checking context: 'can't stat '/Users/tiadem_tatie/.Trash''.
tiadem_tatie#SIT-SMBP1606 ~ % docker build -t <countlynew> .
zsh: no such file or directory: countlynew
tiadem_tatie#SIT-SMBP1606 ~ % docker build -t countlynew path
unable to prepare context: path "path" not found
tiadem_tatie#SIT-SMBP1606 ~ % docker build -t image-name path
unable to prepare context: path "path" not found
tiadem_tatie#SIT-SMBP1606 ~ % docker build -t image-name path
unable to prepare context: path "path" not found
tiadem_tatie#SIT-SMBP1606 ~ % docker run --help
The document Dockerfile is in my downloads folder. Can I have there command and if it is possible , I need help to how to build a mongoDB and Backend .Then I want to connect both together .
Thanky you
Why would you keep your project files in Downloads folder? It sounds like a horrible idea.
Still, assuming that both your Dockerfile and your website files are located there run the following command to build the image:
docker build -t countly_new:latest ~/Downloads
When I try to copy a small file to a Kubernetes pod, it fails with the following error:
:~ $kubectl cp /tmp/a default/resolver-proxy-69dc786fcf-5rplg:/usr/local/bin/ --no-preserve=true
tar: a: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
command terminated with exit code 2
Could someone please help me how to fix this? I am running Kubernetes on minikube.
I also see another Postgres Pod in a Error state because of similar error:
:~ $kubectl logs postgres-7676967946-7lp9g postgres
tar: /var/lib/postgresql/data: Cannot open: Permission denied
tar: Error is not recoverable: exiting now
For kubectl cp try copying first to /tmp folder and then mv the file to the path required by shifting to root user
kubectl cp /tmp/a default/resolver-proxy-69dc786fcf-5rplg:/tmp/
then exec into the pod and change to root and copy to the path required.
For the second issue exec into the pod and fix the permissions by running the below command. Postgres need to be able to read and write to the Postgres path.
chown -R postgres:postgres /var/lib/postgresql/
We have accidently renamed shared library /lib64/libc.so.6 to be /lib64/libc.so_6. Right after previous command the system (CentOS 6.9) throws the following error :
error while loading shared libraries: /lib64/libc.so.6: cannot open shared object file: No such file or directory
When logged in within rescue mode I followed the following commands :
mount /dev/md2 /mnt
mount /dev/md1 /mnt/boot
mount -t dev -o bind /dev /mnt/dev
mount -t proc -o bind /proc /mnt/proc
mount -t sys -o bind /sys /mnt/sys
chroot /mnt
</Code>
Then i get the following error :
/bin/bash: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
I also tried the following commands :
chroot /mnt /bin/bash
chroot /mnt/root/tmp /bin/bash
chroot /mnt/root/tmp /mnt/bin/bash
Then get another error
chroot: failed to run command ‘/mnt/bin/bash’: No such file or directory
Now the system is down and I only have ssh which failed once "libc.so.6" renamed, and rescue mode. How could I enter to system so that i can rename "libc.so_6" back to "libc.so.6"? Is there a work-around to bypass checking for "libc.so_6"?
For the sake of clarity, will post the answer here (in case someone else encounter similar trouble).
When in rescue mode:
mount /dev/md2 /mnt
mv /mnt/lib64/libc.so_6 /mnt/lib64/libc.so.6
Alternatively:
restore system from backup
try booting from some live USB (as Topper Harley proposed in comments)