docker


docker run does not work from cronjob


I got a cronjob set up on an AWS EC2 instance which is supposed to start a docker container:
15 0 * * * docker run -e ENVIRONMENT=dev myrepo/my-image-name
I can see in the cron log it's attempting to run the job, but the container does not get run. Tried with sudo, still does not run. What could be reason for that?
cron does not know about environment variables, e.g. $PATH - so it cannot find docker to run. Should specify full path: /usr/bin/docker, like this:
15 0 * * * /usr/bin/docker run -e ENVIRONMENT=dev myrepo/my-image-name
To those who wonder how to find where the docker lives: run which docker in your console.

Related Links

Expose urls for Docker compose
How to get the container Id of the running container using docker-java?
Docker exit code 125 and 'Device is Busy' error
Unable to create a thinpool in Debian
How to run docker image produced by VS 2017
Spring Boot in Docker
Copy a folder into a mounted volume within a Docker Container
Run image in docker
cron task in docker container not being executed
Use Container Metrics from Prometheus
Docker precheck error “code E_FAIL(0x80004005)”
Is it possible to change the read-only/read-write status of a docker mount at runtime?
Unable to start any container when Volumes are enabled Docker Toolbox
docker-compose up recreates container when config is unchanged
Why does docker-compose not lookup the IP address from the MySQL container?
How to mount volume from container to host in Docker?

Categories

HOME
dropbox-api
soap
kotlin
analytics
set
winzip
luigi
dfa
instagram-api
android-animation
graphviz
apache-apex
snapshot
spring-aop
mupdf
category
ietf-netmod-yang
image-comparison
firebase-cloud-messaging
moshi
gun
xmlstarlet
boost-python
powerpoint-vba
virtuoso
scons
frama-c
rubinius
coupon
post-build-event
gmail-contextual-gadgets
artoolkit
swiftmailer
azure-virtual-machine
filestream
android-auto
marytts
binary-image
cartography
opensmtpd
android-7.1-nougat
sqlcommand
slug
erwin
asana-connect
local-variables
express-stormpath
ldflags
knox-gateway
imshow
deferred-loading
display-bugs
apple-watch-complication
google-plus-domains
nested-forms
powergrep
grid-layout
wns
customdialog
cts
struts2-jquery-grid
bitcount
pdl
dynamics-nav-2009
mpld3
acl2
moovweb
reagent
.a
voog
dcraw
zenoss
iec61131-3
usleep
stackato
fast-esp
rhodecode
intel-galileo
chaplinjs
maptiler
microsoft-search-server
toplink
harfbuzz
fold
emacs-dirtree
addr2line
nsformatter
juggernaut
bootclasspath
dft
context-sensitive-help
progressive-enhancement

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App