I am working on a application where I am running multiple containers using docker-compose.yml. All the containers are successfully up. One of the container is having a cron file with the following contents:
* * * * * sshpass -p root ssh -o StrictHostKeyChecking=no root@myserver"./script.sh" > /proc/1/fd/1 2> /proc/1/fd/2
whenever this cron job is trying to run I am getting the below error in intelliJ console:
cron_1 | crond: USER root pid 35 cmd sshpass -p root ssh -o StrictHostKeyChecking=no root@myserver"./script.sh" > /proc/1/fd
/1 2> /proc/1/fd/2
: nonexistent directory | /bin/sh: can't create /proc/1/fd/2
When I logged in container cli, I can see that directory location exists:-
It's wokring fine on ubuntu but not on windows.
below is the output of docker version
Client: Docker Engine - Community
Cloud integration: 1.0.7
Version: 20.10.2
API version: 1.41
Go version: go1.13.15
Git commit: 2291f61
Built: Mon Dec 28 16:14:16 2020
OS/Arch: windows/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.2
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8891c58
Built: Mon Dec 28 16:15:28 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Can anyone please help how to make the cron run inside container ?
Thanks
Make sure line endings in your cron file set to Linux/UNIX