Time shift measures with Docker for Windows

Overview

Accident memo

  1. On Docker Desktop with WSL2 as the backend, apt throws a Release file for is not valid yet error.

  2. What to do if apt gives a Release file for xxx is not valid yet error in WSL2 integrated Docker for Windows Time adjustment was effective in the container as a countermeasure when hwclock -s did not solve the problem with wsl -d possible distribution, which is the method described in the article.

version

Windows 10 build 19042 Docker Desktop 2.5.0.1

Events and solutions

Event

Execute the following command for the ubuntu: 20.04 container

apt install build-essential

The result is a Release file for xxx is not valid yet error (probably libc6 failed to log).

There were many articles that the time difference on the WSL side was the cause, so I ran the following command, but it didn't work.

wsl -d docker-desktop
hwclock -s

Solution

I decided to solve the problem by adjusting the time with ntpdate on the container side instead of the WSL side.

ntpdate ntp.nict.jp

I was angry with Can't adjust the time of day: Operation not permitted. This is due to the container lacking permissions.

Resolved by passing the --privilaged option to docker run.

docker run -itd --privilaged --name hoge ubuntu:20.04 

It's dangerous because there are too many authorities, but it's a hobby environment, so I'll solve it for the time being. (SYS_TIME, NET_ADMIN was not enough)

Recommended Posts

Time shift measures with Docker for Windows
Measures for permissions when building MySQL with Docker on WSL2
Environment construction with Docker for beginners
Try Oracle Enterprise Manager Cloud Control with Docker Desktop for Windows
Install Docker Desktop for Mac with Homebrew
Getting Started with Docker for Mac (Installation)
Introducing Docker Desktop for Windows on WSL2
For the time being, run the war file delivered in Java with Docker
Docker Desktop for Windows 2.4.0.0 (48506) Startup error after update
I tried using Docker for the first time
Self-hosting with Docker of AuteMuteUs in Windows environment
I tried touching Docker for the first time
[Docker for Mac] Deal with Credentials store error
Tips for improving Jbuilder rendering time with jsonapi-serializer
Docker Container Operations with Docker-Client API for Java
How to start with Hyper-V instead of WSL2 on Docker Desktop for Windows
Whale and Cat Parent-Child Programming-Try Scratch 3.0's original extension with Docker for Windows.
How to use nginx-ingress-controller with Docker for Mac
Operate Docker Desktop for Windows on Linux (WSL)
[Docker for Windows] The Docker app suddenly stopped working ...
3 Tips to Improve Lead Time for Docker Build
Measures for insufficient memory capacity of docker compose build
I tried using Docker Desktop for Windows on Windows 10 Home
Oreore certificate https (2020/12/19) for the first time with nginx
(For myself) Build gitlab with ubuntu18.04 + docker for home (Note)
Try connecting to AzureCosmosDB Emulator for Docker with Java
How to make Laravel faster with Docker for Mac
Build an Android image for Orange Pi 4 with Docker
Command to try using Docker for the time being
Create Chisel development environment with Windows10 + WSL2 + VScode + Docker
Launch MariaDB with Docker
Rails deploy with Docker
Explode Docker with WSL2
Operate Emby with Docker
Try WildFly with Docker
Use ngrok with Docker
Run Payara with Docker
[Docker] Connection with MySQL
Php settings with Docker
Getting Started with Docker
M.S. docker on Windows
Disposable PHP with Docker
Install Composer with Docker
Deploying a Java environment with Windows Subsystem for Linux (WSL)
Hello World with Ruby extension library for the time being
Wait for the container service to start with docker healthcheck
Output time stamp for humans with JSON Layout of log4j2
Time is wrong with the application launched on the Docker container
Measures for taking a long time to load images (Rails)
With the software I've been making for a long time ...
Modeling a Digimon with DDD for the first time Part 1
You are required to use winpty with docker exec [Windows]