Deivitto / Deivitto/auditor-docker

Docker clock out-of-sync disallows package update and upgrade

Open
#19 1 comment 0 reactions 0 assignees View on GitHub
bug Low priority WSL
Dominant language
Shell
Stars
141
Forks
16
PR merge metrics
No merged PRs in 30d

Description

So I wanted to install some stuff through `apt-get` and it crashed. It was a dependency issue. Thus, I executed
```bash
sudo apt-get update
```
And it crashed. Seemingly, the internal clock was out of sync.

Attemtped to use the fix propted in the readme (but for the docker image):
```bash
sudo date -s "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')"
```
Permission denied...
After doing some research, my fix was

### 1. Stopping the docker container
```bash
docker stop devops199
```

### 2. Stashing a copy somewhere else
```bash
docker commit devops199 my_temporary_image
```

### 3. Making sure my local machine's clock was set properly

Because the docker image inherits the time from the machine

### 4. Deleting the old image

```bash
docker rm devops199
```

### 5. Re-running the image

```bash
docker run -it -d --name devops199 -e TZ=MyTimeZone my_temporary_image
```

Replace `MyTimeZone` by the appropriate one (i.e. `America/New_York`, `Europe/Madrid` ...).

The bad thing about this fix is that now I have some space occupied by `my_temporary_image`:

```bash
docker image list
```
yields
```
REPOSITORY TAG IMAGE ID CREATED SIZE
my_temporary_image latest 3a9438defdaf 2 hours ago 5.7GB
whitehat-machine latest 82d98c925275 2 months ago 2.65GB
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.