“date -d” command fails on Docker Alpine Linux container

2 posts / 0 new
Last post
#1 Sat, 2015-05-30 21:35
lgs
  • lgs's picture
  • Offline
  • Last seen: 2 years 10 months ago
  • Joined: 2015-05-30

I built [Alpine Linux][1] in a [Docker container][2] with the following Dockerfile:

FROM alpine:3.2
RUN apk add --update jq curl && rm -rf /var/cache/apk/*

the build run successfully:

$ docker build -t collector .
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Step 0 : FROM alpine:3.2
3.2: Pulling from alpine
8697b6cc1f48: Already exists
alpine:3.2: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:eb84cc74347e4d7c484d566dec8a5eef82bab1b78308b92cda559bcff29c27cc
Status: Downloaded newer image for alpine:3.2
---> 8697b6cc1f48
Step 1 : RUN apk add --update jq curl && rm -rf /var/cache/apk/*
---> Running in 888571296e79
fetch http://dl-4.alpinelinux.org/alpine/v3.2/main/x86_64/APKINDEX.tar.gz
(1/11) Installing run-parts (4.4-r0)
(2/11) Installing openssl (1.0.2a-r1)
(3/11) Installing lua5.2-libs (5.2.4-r0)
(4/11) Installing lua5.2 (5.2.4-r0)
(5/11) Installing ncurses-terminfo-base (5.9-r3)
(6/11) Installing ncurses-widec-libs (5.9-r3)
(7/11) Installing lua5.2-posix (33.3.1-r2)
(8/11) Installing ca-certificates (20141019-r2)
(9/11) Installing libssh2 (1.5.0-r0)
(10/11) Installing curl (7.42.1-r0)
(11/11) Installing jq (1.4-r0)
Executing busybox-1.23.2-r0.trigger
Executing ca-certificates-20141019-r2.trigger
OK: 9 MiB in 26 packages
---> 7625779b773d
Removing intermediate container 888571296e79
Successfully built 7625779b773d

anyway when I run `date -d` it fails:

$ docker run -i -t collector sh
/ # date -d yesterday
date: invalid date 'yesterday'
/ # date -d now
date: invalid date 'now'
/ # date -d next-month
date: invalid date 'next-month'

while the rest of the options seem running ok:

/ # date
Sat May 30 18:57:24 UTC 2015
/ # date +"%A"
Saturday
/ # date +"%Y-%m-%dT%H:%M:%SZ"
2015-05-30T19:00:38Z

[1]: http://alpinelinux.org/
[2]: https://registry.hub.docker.com/_/alpine/

Sun, 2015-05-31 11:36
lgs
  • lgs's picture
  • Offline
  • Last seen: 2 years 10 months ago
  • Joined: 2015-05-30
Log in or register to post comments