How to Fix Docker Stuck on apt-get Update on M1 Mac (Apple Silicon)
Автор: vlogize
Загружено: 2025-03-25
Просмотров: 6
Описание:
Facing issues with Docker on your M1 Mac? Learn how to resolve the "Docker stuck on apt-get update" problem in this detailed guide.
---
This video is based on the question https://stackoverflow.com/q/71977205/ asked by the user 'Hassan Jalil' ( https://stackoverflow.com/u/2557844/ ) and on the answer https://stackoverflow.com/a/71977215/ provided by the user 'Hassan Jalil' ( https://stackoverflow.com/u/2557844/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions.
Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Docker stuck on apt-get update on M1 Mac (Apple Silicone)
Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l...
The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license.
If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com.
---
Troubleshooting Docker Issues on M1 Mac: apt-get update Stuck
If you're using Docker on your new M1 Mac and find yourself stuck on the apt-get update command, you're not alone. Many users have encountered similar frustrations when building Docker images. In this guide, we'll break down the problem and provide you with a straightforward solution.
The Problem: Docker Freezing on apt-get update
You may have a Dockerfile configured as follows:
[[See Video to Reveal this Text or Code Snippet]]
Initially, you noticed that the build completed without errors when you didn’t specify the --platform argument. However, this resulted in building the image for the arm64 architecture, leading to runtime issues later on.
After adding the --platform=linux/amd64 argument to ensure compatibility, you found the build process hangs indefinitely at the RUN apt-get update -y step. This issue persists even after trying out various solutions like running docker system prune -a, indicating a deeper problem at play.
The Solution: A Simple Restart
After troubleshooting various aspects, it turns out that the easiest solution was simply to restart Docker. Yes, it may sound too simple, but sometimes the most effective solutions are the least expected. If you find yourself stuck during any build step in Docker—especially during apt-get update—don't overlook the potential benefit of a quick restart.
Steps to Restart Docker on M1 Mac
Close Docker Desktop:
Click on the Docker icon in your menu bar.
Select "Quit Docker Desktop."
Reopen Docker Desktop:
Locate Docker in your Applications folder and double-click to reopen it.
Retry your Docker Build:
After restarting, go back to your terminal and run your docker build command again.
Why Restarting Works
Clearing Internal States: Restarting Docker resets its networking and internal states, which can sometimes become inconsistent.
Resolving Cache Issues: It may clear any stale caches that are causing your build to freeze.
Conclusion
If you encounter the issue of Docker being stuck during the apt-get update process, simply restarting Docker can often resolve the issue quickly and effectively.
Next time you run into this frustration, remember: when all else fails, a restart might just do the trick!
Feel free to share your experiences in the comments below, and let us know if this solution worked for you.
Повторяем попытку...

Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: