docker-gc icon indicating copy to clipboard operation
docker-gc copied to clipboard

work around macosx date limitation.

Open benson-basis opened this issue 10 years ago • 3 comments

This fixes issue #69 .

benson-basis avatar Nov 23 '15 18:11 benson-basis

What leads to date_parse getting an input of 0001-01-01 00:00:00?

mattnworb avatar Nov 24 '15 00:11 mattnworb

It came out of the docker command as the date on one of my volumes. I didn't, I confess track it further back.

I didn't, by the way, realize that you could run 'docker' commands from inside a container.

On Mon, Nov 23, 2015 at 7:44 PM, Matt Brown [email protected] wrote:

What leads to date_parse getting an input of 0001-01-01 00:00:00?

— Reply to this email directly or view it on GitHub https://github.com/spotify/docker-gc/pull/70#issuecomment-159115396.

benson-basis avatar Nov 24 '15 00:11 benson-basis

date_parse in the example above can happen if a container is in a running state, and if you convert it to epoch it will be negative. I handled it this way; https://github.com/konstruktoid/docker-garby/blob/master/docker-garby.sh#L105-L119

$ date -d "2015-12-01 12:12:00" +%s
1448968320
$ date -d "0001-01-01 00:00:00" +%s
-62135601132

konstruktoid avatar Nov 29 '15 19:11 konstruktoid