Сколько озу ест windows 11

Удалить/очистить все данные Докера (контейнеры, образы, тома и сети)

Одной строкой

docker stop $(docker ps -qa) && docker rm $(docker ps -qa) && docker rmi -f $(docker images -qa) && docker volume rm $(docker volume ls -q) && docker network rm $(docker network ls -q)

Описание команд

👎 Остановка всех контейнеров

docker stop $(docker ps -qa)

✊ Удаление всех контейнеров

docker rm $(docker ps -qa)

✌️ Удаление всех образов

docker rmi -f $(docker images -qa)

👋 Удаление всех томов

docker volume rm $(docker volume ls -q)

✋ Удаление всех сетей

docker network rm $(docker network ls -q)

Ваша инсталяция должна быть чиста 😊

👇 Следующие команды не должны выводить какие-либо элементы:

👉 Следующая команда показывает только сети по умолчанию:

:: Следующая команда удаляет неиспользуемые образы

Время на прочтение8 мин

Количество просмотров189K

Привет, Хабр! Представляю вашему вниманию перевод статьи «Docker Tips: Clean Up Your Local Machine» автора Luc Juggery.

Сегодня мы поговорим о том, как Docker использует дисковое пространство хостовой машины, а также разберемся в том, как это пространство освободить от ошметков неиспользуемых образов и контейнеров.

Общее потребление

Docker – крутая штука, наверное сегодня мало кто в этом сомневается. Всего несколько лет назад этот продукт предоставил нам совершенно новый способ построения, доставки и запуска любого окружения, позволяя значительно сэкономить ресурсы процессора и оперативной памяти. В дополнение к этому (а для кого-то это будет даже самым важным) Docker позволил нам невероятно упростить и унифицировать управление жизненным циклом используемых рабочих сред.

Однако, за все эти прелести современной жизни приходится платить. Когда мы запускаем контейнеры, скачиваем или создаем собственные образы, разворачиваем сложные экосистемы, нам приходится платить. И платим мы, в том числе, дисковым пространством.

Если вы никогда не задумывались о том, сколько же места реально занято на вашей машине Docker’ом, то можете быть неприятно удивлены выводом этой команды:

$ docker system df

Здесь отображено использование диска Docker’ом в различных разрезах:

  • образы (images) – общий размер образов, которые были скачаны из хранилищ образов и построены в вашей системе;
  • контейнеры (containers) – общий объем дискового пространства, используемый запущенными контейнерами (имеется ввиду общий объем слоев чтения-записи всех контейнеров);
  • локальные тома (local volumes) – объем локальных хранилищ, примонтированных к контейнерам;
  • кэш сборки (build cache) – временные файлы, сгенерированные процессом построения образов (при использовании инструмента BuildKit, доступного начиная с Docker версии 18.09).

Готов поспорить, что уже после этого простого перечисления вы горите желанием почистить диск от мусора и вернуть к жизни драгоценные гигабайты (прим. перев.: особенно, если за эти гигабайты вы ежемесячно перечисляете арендную плату).

Использование диска контейнерами

Каждый раз при создании контейнера на хостовой машине в каталоге /var/lib/docker создается несколько файлов и каталогов, среди которых стоит отметить следующие:

  • Каталог /var/lib/docker/containers/ID_контейнера – при использовании стандартного драйвера логгирования именно сюда сохраняются журналы событий в JSON-формате. Слишком подробные логи, а также логи, которые никто не читает и не обрабатывает иными способами, часто становятся причиной переполнения дисков.
  • Каталог /var/lib/docker/overlay2 – содержит слои чтения-записи контейнеров (overlay2 – предпочитаемые драйвер в большинстве дистрибутивов Linux). Если контейнер сохраняет данные в своей файловой системе, то именно в этом каталоге они и будут размещены.

Давайте представим себе систему, на которой установлен девственно чистый Docker, ни разу не участвовавший в запуске контейнеров и сборке образов. Его отчет об использовании дискового пространства будет выглядеть так:

$ docker system df
TYPE           TOTAL      ACTIVE     SIZE       RECLAIMABLE
Images         0          0          0B         0B
Containers     0          0          0B         0B
Local Volumes  0          0          0B         0B
Build Cache    0          0          0B         0B

Запустим какой-нибудь контейнер, например, NGINX:

$ docker container run --name www -d -p 8000:80 nginx:1.16

Что происходит с диском:

  • образы (images) занимают 126 Мб, это тот самый NGINX, который мы запустили в контейнере;
  • контейнеры (containers) занимают смешные 2 байта.

$ docker system df
TYPE           TOTAL      ACTIVE     SIZE       RECLAIMABLE
Images         1          1          126M       0B (0%)
Containers     1          1          2B         0B (0%)
Local Volumes  0          0          0B         0B
Build Cache    0          0          0B         0B

Судя по выводу, у нас еще нет пространства, которое мы могли бы высвободить. Так как 2 байта это совершенно несерьезно, давайте представим, что наш NGINX неожиданно для всех написал куда-то 100 Мегабайт данных и создал внутри себя файл test.img именно такого размера.

$ docker exec -ti www \
  dd if=/dev/zero of=test.img bs=1024 count=0 seek=$[1024*100]

Снова исследуем использование дискового пространства на хосте. Мы увидим, что контейнер (containers) занимает там 100 Мегабайт.

$ docker system df
TYPE           TOTAL      ACTIVE     SIZE       RECLAIMABLE
Images         1          1          126M       0B (0%)
Containers     1          1          104.9MB    0B (0%)
Local Volumes  0          0          0B         0B
Build Cache    0          0          0B         0B

Думаю, ваш пытливый мозг уже задается вопросом, где же находится наш файл test.img. Давайте его поищем:

$ find /var/lib/docker -type f -name test.img
/var/lib/docker/overlay2/83f177...630078/merged/test.img
/var/lib/docker/overlay2/83f177...630078/diff/test.img

Не вдаваясь в подробности можно отметить, что файл test.img удобно расположился на уровне чтения-записи, управляемом драйвером overlay2. Если же мы остановим наш контейнер, то хост подскажет нам, что это место, в принципе, можно высвободить:

# Stopping the www container
$ docker stop www

# Visualizing the impact on the disk usage
$ docker system df
TYPE           TOTAL      ACTIVE     SIZE       RECLAIMABLE
Images         1          1          126M       0B (0%)
Containers     1          0          104.9MB    104.9MB (100%)
Local Volumes  0          0          0B         0B
Build Cache    0          0          0B         0B

Как мы можем это сделать? Удалением контейнера, которое повлечет за собой очистку соответствующего пространства на уровне чтения-записи.

С помощью следующей команды вы можете удалить все установленные контейнеры одним махом и очистить ваш диск от всех созданных ими на уровне чтения-записи файлов:

$ docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
5e7f8e5097ace9ef5518ebf0c6fc2062ff024efb495f11ccc89df21ec9b4dcc2

Total reclaimed space: 104.9MB

Итак, мы высвободили 104,9 Мегабайта удалением контейнера. Но так как мы уже не используем скачанный ранее образ, то он тоже становится кандидатом на удаление и высвобождение наших ресурсов:

$ docker system df
TYPE           TOTAL      ACTIVE     SIZE       RECLAIMABLE
Images         1          0          126M       126M (100%)
Containers     0          0          0B         0B
Local Volumes  0          0          0B         0B
Build Cache    0          0          0B         0B

Внимание: до тех пор, пока образ используется хотя бы одним контейнером, вы не сможете использовать этот трюк.

Субкоманда prune, которую мы использовали выше, дает эффект только на остановленных контейнерах. Если мы хотим удалить не только остановленные, но и запущенные контейнеры, следует использовать одну из этих команд:

# Historical command
$ docker rm -f $(docker ps –aq)

# More recent command
$ docker container rm -f $(docker container ls -aq)

Заметки на полях: если при запуске контейнера использовать параметр —rm, то при его остановке будут высвобождено все дисковое пространство, которое он занимал.

Использование диска образами

Несколько лет назад размер образа в несколько сотен мегабайт был совершенно нормальным: образ Ubuntu весил 600 Мегабайт, а образ Microsoft .Net – несколько Гигабайт. В те лохматые времена скачивание одного только образа могло нанести большой урон вашему свободному месту на диске, даже если вы расшаривали уровни между образами. Сегодня – хвала великим – образы весят намного меньше, но даже в этом случае можно быстро забить имеющиеся ресурсы, если не принимать некоторых мер предосторожности.

Есть несколько типов образов, которые напрямую не видны конечному пользователю:

  • intermediate образы, на основе которых собраны другие образы в – они не могут быть удалены, если вы используете контейнеры на базе этих самых «других» образов;
  • dangling образы – это такие intermediate образы, на которые не ссылается ни один из запущенных контейнеров – они могут быть удалены.
  • С помощью следующей команды вы можете проверить наличие в вашей системе dangling образов:

$ docker image ls -f dangling=true
REPOSITORY  TAG      IMAGE ID         CREATED             SIZE
none      none   21e658fe5351     12 minutes ago      71.3MB

Удалить их можно следующим способом:

$ docker image rm $(docker image ls -f dangling=true -q)

Мы можем использовать также субкоманду prune:

$ docker image prune
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N] y
Deleted Images:
deleted: sha256:143407a3cb7efa6e95761b8cd6cea25e3f41455be6d5e7cda
deleted: sha256:738010bda9dd34896bac9bbc77b2d60addd7738ad1a95e5cc
deleted: sha256:fa4f0194a1eb829523ecf3bad04b4a7bdce089c8361e2c347
deleted: sha256:c5041938bcb46f78bf2f2a7f0a0df0eea74c4555097cc9197
deleted: sha256:5945bb6e12888cf320828e0fd00728947104da82e3eb4452f

Total reclaimed space: 12.9kB

Если мы вдруг захотим удалить вообще все образы (а не только dangling) одной командой, то можно сделать так:

$ docker image rm $(docker image ls -q)

Использование диска томами

Тома (volumes) применяются для хранения данных за пределами файловой системы контейнера. Например, если мы хотим сохранить результаты работы какого-либо приложения, чтобы использовать их как-то еще. Частым примером являются базы данных.

Давайте запустим контейнер MongoDB, примонтируем к нему внешний по отношению к контейнеру том, и восстановим из него бэкап базы данных (у нас он доступен в файле bck.json):

# Running a mongo container
$ docker run --name db -v $PWD:/tmp -p 27017:27017 -d mongo:4.0

# Importing an existing backup (from a huge bck.json file)
$ docker exec -ti db mongoimport \
  --db 'test' \
  --collection 'demo' \
  --file /tmp/bck.json \
  --jsonArray

Данные будут находиться на хостовой машине в каталоге /var/lib/docker/volumes. Но почему не на уровне чтения-записи контейнера? Потому что в Dockerfile образа MongoDB каталог /data/db (в котором MongoDB по умолчанию хранит свои данные) определен как том (volume).

Заметки на полях: многие образы, в результате работы которых должны создаваться данные, используют тома (volumes) для сохранения этих самых данных.

Когда мы наиграемся с MongoDB и остановим (а может даже и удалим) контейнер, том не будет удален. Он продолжит занимать наше драгоценное дисковое пространство до тех пор, пока мы явно не удалим его такой командой:

$ docker volume rm $(docker volume ls -q)

Ну или мы можем использовать уже знакомую нам субкоманду prune:

$ docker volume prune
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N] y
Deleted Volumes:
d50b6402eb75d09ec17a5f57df4ed7b520c448429f70725fc5707334e5ded4d5
8f7a16e1cf117cdfddb6a38d1f4f02b18d21a485b49037e2670753fa34d115fc
599c3dd48d529b2e105eec38537cd16dac1ae6f899a123e2a62ffac6168b2f5f
...
732e610e435c24f6acae827cd340a60ce4132387cfc512452994bc0728dd66df
9a3f39cc8bd0f9ce54dea3421193f752bda4b8846841b6d36f8ee24358a85bae
045a9b534259ec6c0318cb162b7b4fca75b553d4e86fc93faafd0e7c77c79799
c6283fe9f8d2ca105d30ecaad31868410e809aba0909b3e60d68a26e92a094da

Total reclaimed space: 25.82GB
luc@saturn:~$

Использование диска для кэша сборки образов

В Docker 18.09 процесс создания образов претерпел некоторые изменения благодаря инструменту BuildKit. С помощью этой штуки увеличивается скорость процесса, оптимизируется управление хранением данных и безопасностью. Здесь мы не будем рассматривать все детали этого замечательного инструмента, остановимся лишь нам том, как он затрагивает вопросы использования дискового пространства.

Предположим, что у нас есть совершенно простое приложение Node.Js:

  • файл index.js запускает простой HTTP сервер, который отвечает строкой на каждый полученный запрос:
  • файл package.json определяет зависимости, из которых используется только expressjs для запуска HTTP сервера:

$ cat index.js
var express = require('express');
var util    = require('util');
var app = express();
app.get('/', function(req, res) {
  res.setHeader('Content-Type', 'text/plain');
  res.end(util.format("%s - %s", new Date(), 'Got Request'));
});
app.listen(process.env.PORT || 80);

$ cat package.json
    {
      "name": "testnode",
      "version": "0.0.1",
      "main": "index.js",
      "scripts": {
        "start": "node index.js"
      },
      "dependencies": {
        "express": "^4.14.0"
      }
    }

Dockerfile для сборки образа выглядит так:

FROM node:13-alpine
COPY package.json /app/package.json
RUN cd /app && npm install
COPY . /app/
WORKDIR /app
EXPOSE 80
CMD ["npm", "start"]

Давайте соберем образ обычным способом, без использования BuildKit:

$ docker build -t app:1.0 .

Если мы проверим использование дискового пространства, то увидим, что место занимают только базовый образ (node:13-alpine) и конечный образ (app:1.0):

TYPE           TOTAL      ACTIVE     SIZE       RECLAIMABLE
Images         2          0          109.3MB    109.3MB (100%)
Containers     0          0          0B         0B
Local Volumes  0          0          0B         0B
Build Cache    0          0          0B         0B

Давайте соберем вторую версию нашего приложения, уже с использованием BuildKit. Для этого нам лишь необходимо установить переменную DOCKER_BUILDKIT в значение 1:

$ DOCKER_BUILDKIT=1 docker build -t app:2.0 .

Если мы сейчас проверим использование диска, то увидим, что теперь там участвует кэш сборки (buid-cache):

$ docker system df
TYPE           TOTAL      ACTIVE     SIZE       RECLAIMABLE
Images         2          0          109.3MB    109.3MB (100%)
Containers     0          0          0B         0B
Local Volumes  0          0          0B         0B
Build Cache    11         0          8.949kB    8.949kB

Для его очистки воспользуемся следующей командой:

$ docker builder prune
WARNING! This will remove all dangling build cache.
Are you sure you want to continue? [y/N] y
Deleted build cache objects:
rffq7b06h9t09xe584rn4f91e
ztexgsz949ci8mx8p5tzgdzhe
3z9jeoqbbmj3eftltawvkiayi

Total reclaimed space: 8.949kB

Очистить все!

Итак, мы рассмотрели очистку дискового пространства, занятого контейнерами, образами и томами. В этом нам помогает субкоманда prune. Но ее можно использовать и на системном уровне docker, и она очистит все, что только сможет:

$ docker system prune
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

Are you sure you want to continue? [y/N]

Если вы по каким-либо причинам экономите дисковое пространство на машине с Docker, то периодический запуск этой команды стоит ввести в привычку.

Cover image for Limiting Docker Memory Usage on Windows

As a WordPress developer, I used XAMPP for a long time, but for lots of reasons, some of which you can see in this other article: Why I changed from XAMPP to Docker, I decided to move to a Docker environment.

Turns out, the besides the learning curve to handle with Docker, and all other stuff, other problem came up. My poor Windows machine has become sluggish as it struggles to run other processes like Firefox and VS Code. It was basically impossible to work.

I opened up Task Manager while WSL 2 was running and noticed that the process named vmmem was absorbing a sizable chunk of my memory and slowing down my machine, turning impossible any other task.

What’s it vmmem?

vmmem is a process that represents all the resources consumed by your Linux VM while WSL is running. According to Microsoft’s documentation, the amount of RAM that gets allocated to WSL depends on your Windows build number. On machines running build 20175 or higher, RAM is limited to either 50% of your total memory or 8GB, whichever happens to be smaller. On builds older than 20175, WSL could consume up to 80% of your host RAM.

While working on this article, I’m running a Windows 10 build 19044, so my WSL reserves 80% of my host RAM (8 GB). Fortunately, we can customize WSL 2 to limit the number of CPU cores, memory usage, swap space, and more. A big thanks to all the ones who replied in this GitHub issue pointing out how this can be done.

Workaround

To solve this, I follow the steps according to the Microsoft documentation.

Create a .wslconfig file

You need to create a .wslconfig file under your Windows user profile directory (C:\Users\YourUsername.wslconfig). On launch, WSL will read this file if it exists and configure itself accordingly. In this file, you can tell WSL 2 how much RAM, swap space, CPU cores, and other resources it should allocate.

I focused only on limiting memory usage, but you can configure any other options that you want, refer to the Microsoft docs for more options. The .wslconfig I am currently using is below (I don’t have a lot of RAM to work with):

[wsl2]
memory=2GB

Enter fullscreen mode

Exit fullscreen mode

With just two lines, now I am able to run Docker on a machine with just 8 GB RAM. After restarting and launching docker-compose up again, my environment works perfectly without slowing down my machine.

Image description

Checking the Task Manager, vmmem does not consume more than 2 GB anymore. This is this my Docker environment which I use on daily basis working with WordPress and works perfectly with 2 GB RAM.

Uninstalling Docker Desktop may seem daunting, but with the help of this simple guide, you’ll be able to remove it from your system in no time.

Key Takeaways:

  • Uninstalling Docker Desktop is a straightforward process that requires a few steps.
  • For Windows users, the process involves stopping running containers, removing Docker from the system, and clearing any leftover data and components.
  • On macOS, you can uninstall Docker by using the Docker Desktop app itself or manually removing all Docker files using Finder or Terminal.
  • Following the provided steps will help you successfully uninstall Docker Desktop from your Windows or macOS machine.
  • Consider alternative solutions if you no longer wish to use Docker or experience issues with it.

There are various reasons why you might want to remove Docker Desktop from your computer. Whether you need to free up valuable disk space or resolve any compatibility issues, uninstalling Docker Desktop can be a practical solution. By removing Docker and its associated components, you can declutter your system and ensure smooth operation.

Free up Disk Space

Docker Desktop can occupy a significant amount of disk space, especially if you have been using it to run multiple containers or images. By uninstalling Docker Desktop, you can reclaim this space and use it for other purposes, such as storing important files or installing other software.

Troubleshoot Issues

If you have been experiencing any issues or conflicts with Docker Desktop, uninstalling it can help resolve these problems. Removing Docker and reinstalling it can sometimes be an effective troubleshooting step, allowing you to start with a clean slate and potentially fix any underlying issues.

Switch to an Alternative Solution

While Docker Desktop is widely used and offers a range of features, you may find that another containerization solution better suits your needs. Uninstalling Docker Desktop allows you to explore alternative options and find a tool that aligns with your requirements and preferences.

Reasons to Uninstall Docker Desktop:
Free up disk space
Troubleshoot issues
Switch to an alternative solution

Stopping Running Containers

Before you begin the uninstallation process, it’s important to stop any running containers in Docker Desktop to prevent any potential issues during the removal.

To stop running containers, follow these steps:

  1. Open Docker Desktop on your system.
  2. In the Docker Dashboard, navigate to the “Containers/Apps” section.
  3. Locate the running containers and click on the “Stop” button next to each container.
  4. Wait for the containers to stop completely before proceeding with the uninstallation process.

Stopping the running containers ensures that there are no active processes that could interfere with the removal of Docker Desktop.

Table 1: Steps to Stop Running Containers

Step Number Instructions
Step 1 Open Docker Desktop on your system.
Step 2 Navigate to the “Containers/Apps” section in the Docker Dashboard.
Step 3 Locate the running containers and click on the “Stop” button next to each container.
Step 4 Wait for the containers to stop completely before proceeding with the uninstallation process.

By following these steps, you can ensure a smooth uninstallation process and avoid any potential issues that may arise from running containers.

Uninstalling Docker Desktop on Windows

If you’re using a Windows machine, follow these easy steps to uninstall Docker Desktop and remove all its components from your system. To ensure a clean uninstallation, it’s important to stop any running containers in Docker Desktop before proceeding. Here’s how:

  1. Open Docker Desktop on your Windows machine.
  2. In the system tray, right-click on the Docker icon.
  3. From the drop-down menu, select “Stop Docker Desktop”.

Once you have stopped the running containers, you can proceed with uninstalling Docker Desktop:

  1. Go to the Start menu and click on the Settings icon.
  2. In the Settings window, select “Apps”.
  3. Scroll down and find “Docker Desktop” in the list of installed apps.
  4. Click on “Docker Desktop” and select “Uninstall”.
  5. Follow the on-screen instructions to complete the uninstallation process.

After uninstalling Docker Desktop, it’s recommended to clear any leftover data and components to ensure a thorough removal. Here’s how you can do it:

  1. Open File Explorer and navigate to the following location:

    1

    C:UsersYourUsernameAppDataRoamingDocker

    .

  2. Delete the “Docker” folder.
  3. Next, navigate to the following location:

    .

  4. Delete the “Docker” folder from here as well.

By following these steps, you should be able to successfully uninstall Docker Desktop from your Windows machine and remove all its associated components.

Step Description
1 Stop running containers in Docker Desktop by right-clicking on the Docker icon in the system tray and selecting “Stop Docker Desktop”.
2 Go to the Start menu, click on the Settings icon, and select “Apps”.
3 Scroll down and find “Docker Desktop” in the list of installed apps. Click on it and select “Uninstall”.
4 Follow the on-screen instructions to complete the uninstallation process.
5 Open File Explorer and delete the “Docker” folder located in

1

C:UsersYourUsernameAppDataRoamingDocker

.

6 Delete the “Docker” folder located in

1

C:ProgramDataDocker

.

Clearing Leftover Data and Components (Windows)

To ensure a thorough uninstallation of Docker Desktop on Windows, it’s important to clear any leftover data and components from your system. This step helps to free up disk space and ensures a clean removal of Docker Desktop.

Here is a step-by-step guide to clearing leftover data and components after uninstalling Docker Desktop on Windows:

  1. Open the File Explorer on your Windows machine.
  2. Navigate to the following location:

    .

  3. Delete the entire

    folder.

  4. Next, press

    on your keyboard to open the Run dialog box.

  5. Type

    and click OK to open the Registry Editor.

  6. In the Registry Editor, navigate to

    1

    HKEY_CURRENT_USERSoftwareDocker Desktop

    and delete the

    folder.

  7. Finally, empty your Recycle Bin to permanently delete the Docker files.

By following these steps, you can ensure that all the leftover data and components of Docker Desktop are removed from your Windows system.

Step Action
1 Open File Explorer
2 Navigate to C:Program FilesDocker
3 Delete Docker folder
4 Press Win + R
5 Type regedit and click OK
6 Delete HKEY_CURRENT_USERSoftwareDocker Desktop folder in Registry Editor
7 Empty Recycle Bin

Uninstalling Docker Desktop on macOS

If you’re using a macOS machine, follow these step-by-step instructions to remove Docker Desktop from your system either through the Docker Desktop app or manually using Finder or Terminal.

  1. Uninstalling Docker Desktop using the Docker Desktop app:
    1. Open the Docker Desktop app on your macOS machine.
    2. Navigate to the top menu and click on “Docker” (next to the Apple icon).
    3. From the dropdown menu, select “Preferences.”
    4. In the Preferences window, go to the “Uninstall” tab.
    5. Click the “Uninstall” button.
    6. Follow the prompts to complete the uninstallation process.
  2. Manually removing Docker Desktop files using Finder or Terminal:
    1. Open Finder and click on “Go” in the top menu.
    2. From the dropdown menu, select “Go to Folder.”
    3. Type

      and press Enter.

    4. Locate the “Application Support” folder and delete the “Docker” folder.
    5. Go back to the “Library” folder and open the “Preferences” folder.
    6. Delete the files or folders associated with Docker (e.g.,

      ).

    7. Open Terminal and execute the following command to remove Docker-related files:

      .

By following these instructions, you can successfully uninstall Docker Desktop from your macOS machine, freeing up disk space and removing all associated components. Remember to carefully follow the steps and ensure all files and folders related to Docker are deleted to complete the uninstallation process.

Clearing Leftover Data and Components (macOS)

After uninstalling Docker Desktop on macOS, it’s essential to clear any remaining data and components to fully remove it from your system. This ensures a clean uninstallation and frees up disk space. Here are two methods you can use to clear leftover data and components:

Method 1: Using the Docker Desktop app

If you chose to uninstall Docker Desktop using the Docker Desktop app, follow these steps to clear any remaining data:

  1. Open the Finder on your macOS system.
  2. Navigate to the “Applications” folder.
  3. Locate and open the “Docker” folder.
  4. Drag the “Docker.app” file to the Trash.
  5. Right-click on the Trash icon and select “Empty Trash” to permanently delete the Docker app.

Method 2: Manually removing Docker files

If you want to manually remove Docker files using Finder or Terminal, follow these steps:

  1. Open the Finder on your macOS system.
  2. Click on the “Go” menu in the menu bar and select “Go to Folder…”.
  3. Type “/usr/local” and click “Go”.
  4. Locate and delete the “docker” folder, if it exists.
  5. Open Terminal and run the following command to remove additional Docker files:

    1

    <a class=»wpil_keyword_link» href=»https://www.howto-do.it/what-is-sudo-superuser-do/»   title=»sudo» data-wpil-keyword-link=»linked»>sudo</a> rm -rf ~/.docker

  6. Enter your administrator password when prompted.

By following these methods, you can ensure that all Docker-related files and components are removed from your macOS system. This will free up valuable disk space and ensure a complete uninstallation of Docker Desktop.

Troubleshooting Common Issues

While uninstalling Docker Desktop is generally straightforward, you may encounter some issues along the way. Here are some common problems and their solutions to help you successfully complete the uninstallation.

1. Error: “Docker Desktop is still running.”

If you receive this error message, it means that Docker Desktop is still running in the background. To resolve this issue, you need to manually stop Docker Desktop by following these steps:

  1. Open the Task Manager by pressing Ctrl+Shift+Esc.
  2. In the Processes or Details tab, locate the Docker Desktop process.
  3. Right-click on the process and select “End Task” or “End Process”.

2. Unable to uninstall Docker Desktop on Windows.

If you’re having trouble uninstalling Docker Desktop on Windows, you can try the following steps to resolve the issue:

  1. Restart your computer and try uninstalling Docker Desktop again.
  2. If the issue persists, open the Command Prompt with administrative privileges.
  3. Type the command “wmic product where name=’Docker Desktop’ call uninstall” and press Enter.
  4. Follow the prompts to complete the uninstallation process.

3. Leftover Docker files and components.

After uninstalling Docker Desktop, you may find that there are still leftover files and components on your system. To remove them completely, follow these steps:

  1. Open File Explorer and navigate to the following directories:
  • C:Program FilesDocker
  • C:Users{your_username}AppDataRoamingDocker
  • C:Users{your_username}AppDataLocalDocker
  • Delete all Docker-related files and folders.
  • Empty the Recycle Bin to permanently delete the files.
Issue Solution
Error: “Docker Desktop is still running.” Manually stop Docker Desktop process in Task Manager.
Unable to uninstall Docker Desktop on Windows. Restart computer and try uninstalling again. If it persists, use Command Prompt with administrative privileges.
Leftover Docker files and components. Delete files and folders in specific directories.

By following these troubleshooting steps, you should be able to overcome any common issues and successfully uninstall Docker Desktop from your Windows or macOS machine.

Reinstalling Docker Desktop (Optional)

If you ever decide to reinstall Docker Desktop, here are the steps to guide you through the installation process after successful uninstallation:

  1. Visit the official Docker website and download the latest version of Docker Desktop for your operating system.
  2. Run the installer and follow the on-screen instructions to complete the installation.
  3. Once the installation is complete, launch Docker Desktop from your applications or desktop shortcut.
  4. Sign in to your Docker account or create a new one if you don’t have an existing account.
  5. Configure Docker Desktop settings according to your preferences, such as resource allocation and network settings.
  6. Click on the “Apply & Restart” button to save the changes and restart Docker Desktop.
  7. You have now successfully reinstalled Docker Desktop and can begin using it for your containerization needs.

Remember to follow any additional instructions provided by the installer to ensure a smooth reinstallation process. If you encounter any issues or errors during the installation, refer to Docker’s official documentation or reach out to their support team for assistance.

Operating System Installation Steps
Windows
  1. Download the Docker Desktop installer for Windows from the official website.
  2. Run the installer and follow the on-screen instructions to complete the installation.
  3. Launch Docker Desktop and sign in to your Docker account or create a new one.
  4. Configure Docker Desktop settings as per your requirements.
  5. Click on the “Apply & Restart” button to save the changes and restart Docker Desktop.
macOS
  1. Download the Docker Desktop installer for macOS from the official website.
  2. Open the installer package and drag the Docker icon to the Applications folder.
  3. Launch Docker Desktop from the Applications folder.
  4. Sign in to your Docker account or create a new one.
  5. Configure Docker Desktop settings according to your preferences.
  6. Click on the “Apply & Restart” button to save the changes and restart Docker Desktop.

If you ever decide to reinstall Docker Desktop, here are the steps to guide you through the installation process after successful uninstallation.

Alternative Solutions

If Docker Desktop isn’t meeting your needs or you’re seeking alternative solutions, here are some popular options you can explore:

  1. Kubernetes: A widely-used open-source container orchestration platform that allows you to manage and deploy containers at scale. Kubernetes offers advanced features for managing containerized applications and provides a flexible and scalable solution.
  2. Podman: An alternative to Docker that enables you to run and manage containers without requiring a separate daemon. Podman is compatible with Docker images and offers a secure and lightweight container runtime.

Additionally, you may consider the following:

  • VirtualBox: A powerful virtualization tool that allows you to create and manage virtual machines. VirtualBox provides a complete operating system environment and is suitable for running different operating systems on a single machine.
  • Vagrant: A tool for creating and managing reproducible development environments. Vagrant simplifies the process of setting up and sharing development environments across different machines.

These alternatives offer different features and functionalities, so it’s important to assess your specific needs and requirements before making a decision. Remember to research each option and consider factors such as ease of use, community support, and compatibility with your existing infrastructure.

Tool Description
Kubernetes A popular open-source container orchestration platform for managing and deploying containers at scale.
Podman An alternative container runtime to Docker that offers compatibility with Docker images and a lightweight architecture.
VirtualBox A virtualization tool for creating and managing virtual machines with different operating systems.
Vagrant A tool for creating and managing reproducible development environments across different machines.

Removing Docker Images and Containers (Optional)

If you want to completely remove all Docker images and containers from your system, here’s how you can do it as an additional step after uninstalling Docker Desktop.

The first step is to open a command prompt or terminal window. On Windows, you can do this by pressing the Windows key, typing “cmd,” and selecting the Command Prompt app. On macOS, you can use the Terminal app, which can be found in the Utilities folder within the Applications folder.

Once you have the command prompt or terminal open, you can use the following commands to remove Docker images and containers:

Command Description

1

docker rm $(docker ps -a -q)

Removes all stopped containers.

1

docker rmi $(docker images -a -q)

Removes all images.

Note: These commands will remove all containers and images from your system, so make sure you have backups or copies of any important data before running them.

By running these commands, you’ll ensure that no remnants of Docker, such as unused images or containers, are left on your system. This can help free up disk space and ensure a clean removal of Docker from your machine.

Remember, this step is optional and should only be performed if you want to completely remove all Docker-related files from your system. If you plan on reinstalling Docker or using it in the future, these commands will erase all your images and containers.

Conclusion

Uninstalling Docker Desktop can be a simple and effective process if you follow the steps outlined in this guide. By removing Docker Desktop properly, you can free up disk space and address any issues that may arise, ensuring a smooth transition or alternative solution.

For Windows users, the uninstallation process involves stopping any running containers in Docker Desktop, accessing the Control Panel to remove Docker from the system, and clearing any leftover data and components. This comprehensive approach ensures a complete removal of Docker Desktop from your Windows machine.

If you’re using a macOS system, you have the option of uninstalling Docker Desktop using the Docker Desktop app itself or manually removing all Docker files using Finder or Terminal. Regardless of your preferred method, it’s important to follow the steps carefully to ensure a clean uninstallation.

In conclusion, by following the steps provided in this guide, you can successfully uninstall Docker Desktop from your Windows or macOS machine. This not only frees up disk space but also allows you to troubleshoot any issues and consider alternative solutions. Remember, proper uninstallation is key to maintaining the performance and functionality of your system.

FAQ

How do I uninstall Docker Desktop?

Uninstalling Docker Desktop is a straightforward process that involves stopping running containers, removing Docker from the system, and clearing any leftover data and components. Detailed instructions can be found in the article.

Why would I want to uninstall Docker Desktop?

There are several reasons why someone may want to uninstall Docker Desktop, such as freeing up disk space, troubleshooting issues, or switching to an alternative solution. The article provides more information on this topic.

How do I stop running containers before uninstalling Docker Desktop?

Stopping running containers is an important step in the uninstallation process to ensure a clean removal. The article provides instructions on how to perform this step.

How do I uninstall Docker Desktop on Windows?

Uninstalling Docker Desktop on Windows involves accessing the Control Panel and removing Docker from the system. The article provides step-by-step instructions for this process.

How do I clear leftover data and components after uninstalling Docker Desktop on Windows?

Clearing any leftover data and components after uninstalling Docker Desktop on Windows ensures a complete removal. The article provides details on how to perform this additional step.

How do I uninstall Docker Desktop on macOS?

Uninstalling Docker Desktop on macOS can be done using the Docker Desktop app itself or by manually removing Docker files using Finder or Terminal. The article provides step-by-step instructions for both methods.

How do I clear leftover data and components after uninstalling Docker Desktop on macOS?

Clearing any leftover data and components after uninstalling Docker Desktop on macOS is essential for a clean uninstallation. The article provides guidance on how to perform this task.

What should I do if I encounter any issues during the uninstallation process?

The article offers troubleshooting steps to address common issues that may arise during the uninstallation of Docker Desktop. Following these steps should help overcome any problems.

Is reinstalling Docker Desktop an optional step?

Yes, reinstalling Docker Desktop is an optional step. The article provides guidance for those who may want to reinstall Docker Desktop in the future.

Are there alternative solutions to Docker Desktop?

Yes, there are alternative solutions to Docker Desktop. The article explores some options that users can consider if they no longer wish to use Docker or experience issues with it.

Is removing Docker images and containers after uninstalling Docker Desktop optional?

Yes, removing Docker images and containers after uninstalling Docker Desktop is an optional step for those who want to further clean up their system. The article provides information on how to perform this step.

  • About the Author
  • Latest Posts

Mark is a senior content editor at Text-Center.com and has more than 20 years of experience with linux and windows operating systems. He also writes for Biteno.com

Skip to content

Deploy Mastery

Docker is the leading containerization platform that simplifies the deployment and administration of applications.

However, there are situations where you might want to uninstall Docker, such as concerns over its licensing terms, which have raised issues about potential costs and compliance for some organizations.

This has prompted users to look for alternative container platforms.

Let’s go through how to uninstall Docker on Windows, Mac, and Linux.

  • Uninstall Docker on Widows
  • Uninstall Docker on Mac
  • Uninstall Docker on Linux

    Uninstall Docker on Widows

    To uninstall Docker on Windows, you can follow these steps:[1][2]

    1. First, let’s remove all Docker containers, images, and networks created or used by Docker:
      • To stop all running containers, run this command in a CMD prompt or Powershell terminal: docker stop $(docker ps -a -q)
      • To delete all containers, images, and networks, run this command: docker system prune -a
    2. Next, go to the Windows Start menu, search for “Add or remove programs” and open it.
    3. Find “Docker Desktop” in the list of installed applications then click the “Uninstall” button.
    4. You can optionally remove any lingering files and folders that Docker may leave such as its installation directory which is C:\ProgramData\Docker by default.
    5. Docker for Windows may have enabled Hyper-V and related features. To disable these features, you can open “Control Panel,” navigate to “Programs and Features,” click on “Turn Windows features on or off,” and then uncheck the features related to Hyper-V and virtualization.

    After uninstalling Docker and disabling related features, it’s a good idea to reboot your computer.

    To uninstall Docker on Mac, you can follow these steps:[3]

    1. First, let’s remove all Docker containers, images, and networks created or used by Docker:
      • To stop all running containers, run this command in a CMD prompt or Powershell terminal: docker stop $(docker ps -a -q)
      • To delete all containers, images, and networks, run this command: docker system prune -a
    2. Click on the “Docker Desktop” icon in the menu bar and select “Quit Docker Desktop” to stop the Docker application.
    3. Open Finder, go to your Applications folder, and find “Docker”. Drag the Docker application to the Trash.
    4. Docker may leave behind some data, including containers, images, and configurations. To remove this data, open Terminal and run the following commands:
      • rm -rf ~/.docker
      • rm -rf ~/Library/Containers/com.docker.docker
    5. If you’ve set up shell completions for Docker (e.g., using Zsh or Bash), you can remove them by deleting the relevant configuration files. For example, if you’re using Zsh, you might remove the Docker completions with: rm -f ~/.zsh/completion/_docker

    It’s a good practice to restart your Mac at this point.

    Uninstall Docker on Linux

    The exact steps to uninstall Docker on Linux can vary depending on your Linux distribution. Here are general instructions for some common Linux distributions: Ubuntu, CentOS, and Fedora. Be sure to adapt these commands to your specific distribution:[4][5]

    1. First, let’s remove all Docker containers, images, and networks created or used by Docker:
      • To stop all running containers, run this command in a CMD prompt or Powershell terminal: docker stop $(docker ps -a -q)
      • To delete all containers, images, and networks, run this command: docker system prune -a
    2. Uninstall Docker’s packages:
      • For Ubuntu: sudo apt-get remove docker-ce docker-ce-cli containerd.io
      • For CentOS: sudo yum remove docker-ce docker-ce-cli containerd.io
      • For Fedora: sudo dnf remove docker-ce docker-ce-cli containerd.io
    3. To remove all Docker-related configuration files, you can use the following command:
      • sudo rm -rf /var/lib/docker
    4. To ensure there are no remaining Docker files or directories, run:
      • sudo rm -rf /etc/docker

    References

    1. “Uninstall docker desktop.” (2023, December 5). Docker Documentation. https://docs.docker.com/desktop/uninstall/ ↩︎
    2. Ariel. (2023, November 3). How to Uninstall Docker from Windows/Mac Completely? [Full Guide] – MiniTool Partition Wizard. MiniTool. https://www.partitionwizard.com/partitionmagic/uninstall-docker.html ↩︎
    3. Lanman, J. (2023, July 4). How to safely uninstall Docker desktop from a Mac. MUO. https://www.makeuseof.com/how-to-uninstall-docker-desktop-mac/ ↩︎
    4. Nek, D. (2023, October 18). How to uninstall Docker on Ubuntu. Linux Tutorials for Beginners. https://webhostinggeeks.com/howto/how-to-uninstall-docker-on-ubuntu/ ↩︎
    5. Uninstall Docker from Linux (CentOS 7, RedHat 7). (n.d.). https://www.learn-it-with-examples.com/development/virtualization/docker/uninstallation-docker-from-linux.html ↩︎

    Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии
  • Файлы тем для windows 7
  • Core 2 duo e4500 windows 10
  • Microsoft windows recovery environment
  • Pc health check windows 11 ваша организация
  • Конвертер apk в exe для windows онлайн