Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Why Chrome Forgets Its Tabs in a Container — And How I Fixed It

Описание и применение

Chrome в Docker‑контейнере после перезапуска открывает только about:blank. Скрипт, запускаемый при старте контейнера, сохраняет открытые вкладки каждые 60 секунд и восстанавливает их при следующем запуске, тем самым устраняя потерю контекста.

Задача

Chrome in a Docker container always starts with a single blank tab after a restart, losing the user’s open tabs.

Результат

After implementing the tabs_keeper.py script, the Chrome container reliably restores the last session on every restart, eliminating the 10‑minute context rebuild period.

Рабочий процесс

  • 1. Detect browser startup and check if any real page is open.
  • 2. If no page is open, read the last‑known tab URLs from a snapshot file and open them via the CDP.
  • 3. Every 60 s, query the CDP for current tab URLs and write them to the snapshot file.
  • 4. Run this script as a container‑init hook so it starts automatically with the container.

Доказательства

Every time the container restarts, the browser comes back with a single blank tab.

Источник

Chrome’s restore machinery needs a session it considers interrupted or resumable.

Источник

The data was never missing. The profile’s session directory was being written continuously, seconds apart, the whole time.

Источник

  • Дата записи: 2026-11-01T09:14:03.300Z