By default docker use a root user in a Dockerfile. If I use a root user (docker default user), I can build flask image with (docker build and docker run) or docker-compose up --build and everything works fine apart from having a warning about Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager.
To avoid the warning, I then decided to add a non root user in the Dockerfile. The warning disappeared indeed, I can also build flask image with (docker build and docker run) that works fine. But unfortunately it doesn't work anymore with docker-compose up --build
So the question is: how to avoid the warning above and still have docker-compose up --build working fine
Here are my Dockerfile and docker-compose.yml with non root user
FROM python:3.10
RUN useradd -ms /bin/bash myuser
USER myuser
WORKDIR /home/myuser
RUN pip install --upgrade --user pip
COPY --chown=myuser:myuser ./code/* ./
RUN pip install -r requirements.txt --user --no-warn-script-
location
ENV PATH="/home/myuser/.local/bin:${PATH}"
version: '3.9'
services:
flask:
build: .
container_name: flask_container
command: python main.py
# user: 1000:1000
ports:
- 5000:5000
volumes:
- ./code:/home/myuser
After running docker-compose up --build I'm getting the following error(same error when using user: 1000:1000): ModuleNotFoundError: No module named 'flask'
Collecting Flask
Downloading Flask-2.0.3-py3-none-any.whl (95 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 95.6/95.6 KB 2.1
MB/s eta 0:00:00
Collecting itsdangerous>=2.0
Downloading itsdangerous-2.1.1-py3-none-any.whl (15 kB)
Collecting Werkzeug>=2.0
Downloading Werkzeug-2.0.3-py3-none-any.whl (289 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 289.2/289.2 KB 4.4
MB/s eta 0:00:00
Collecting Jinja2>=3.0
Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.6/133.6 KB 3.0
MB/s eta 0:00:00
Collecting click>=7.1.2
Downloading click-8.0.4-py3-none-any.whl (97 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.5/97.5 KB 2.7
MB/s eta 0:00:00
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.1.1-cp310-cp310-
manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Installing collected packages: Werkzeug, MarkupSafe,
itsdangerous, click, Jinja2, Flask
Successfully installed Flask-2.0.3 Jinja2-3.0.3 MarkupSafe-2.1.1
Werkzeug-2.0.3 click-8.0.4 itsdangerous-2.1.1
Removing intermediate container 79206447dcf5
---> 51797f14d971
Step 8/8 : ENV PATH="/home/myuser/.local/bin:${PATH}"
---> Running in bc4b778bac5d
Removing intermediate container bc4b778bac5d
---> 195f721ef077
Successfully built 195f721ef077
Successfully tagged docker-dev_flask:latest
Creating flask_container ... done
Attaching to flask_container
flask_container | Traceback (most recent call last):
flask_container | File "/home/myuser/main.py", line 1, in
<module>
flask_container | from flask import Flask
flask_container | ModuleNotFoundError: No module named 'flask'
flask_container exited with code 1
But everything works fine when using root user
FROM python:3.10
WORKDIR /code
COPY ./code/* ./
RUN pip install -r requirements.txt
version: '3.9'
services:
flask:
build: .
container_name: flask_container
command: python main.py
ports:
- 5000:5000
volumes:
- ./code:/code
docker-compose up --build doesn't fail but gives a warning about using a root user.
Collecting Flask
Downloading Flask-2.0.3-py3-none-any.whl (95 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 95.6/95.6 KB 1.8
MB/s eta 0:00:00
Collecting click>=7.1.2
Downloading click-8.0.4-py3-none-any.whl (97 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.5/97.5 KB 1.5
MB/s eta 0:00:00
Collecting Jinja2>=3.0
Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.6/133.6 KB 1.8
MB/s eta 0:00:00
Collecting Werkzeug>=2.0
Downloading Werkzeug-2.0.3-py3-none-any.whl (289 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 289.2/289.2 KB 1.8
MB/s eta 0:00:00
Collecting itsdangerous>=2.0
Downloading itsdangerous-2.1.1-py3-none-any.whl (15 kB)
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.1.1-cp310-cp310-
manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Installing collected packages: Werkzeug, MarkupSafe,
itsdangerous, click, Jinja2, Flask
Successfully installed Flask-2.0.3 Jinja2-3.0.3 MarkupSafe-
2.1.1 Werkzeug-2.0.3 click-8.0.4 itsdangerous-2.1.1
WARNING: Running pip as the 'root' user can result in broken
permissions and conflicting behaviour with the system package
manager. It is recommended to use a virtual environment
instead: https://pip.pypa.io/warnings/venv
Removing intermediate container b9626dc2cd44
---> 42f016cc5667
Successfully built 42f016cc5667
Successfully tagged docker-dev_flask:latest
Creating flask_container ... done
Attaching to flask_container
flask_container | * Serving Flask app 'main' (lazy loading)
flask_container | * Environment: production
flask_container | WARNING: This is a development server. Do
not use it in a production deployment.
flask_container | Use a production WSGI server instead.
flask_container | * Debug mode: off
flask_container | * Running on all addresses.
flask_container | WARNING: This is a development server. Do
not use it in a production deployment.
flask_container | * Running on http://172.18.0.2:5000/ (Press
CTRL+C to quit)
How can I solve this issue ? Thanks for your help
Related
I am trying to run MongoDB by running brew services start mongodb-community#4.2 but I am getting the error that you see below:
jaimes-mbp:SMR jaimemontoya$ brew services start mongodb-community#4.2
==> Tapping homebrew/services
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 27 (delta 0), reused 16 (delta 0), pack-reused 0
Unpacking objects: 100% (27/27), done.
Checking connectivity... done.
Tapped 0 formulae (63 files, 276K)
Error: Unknown command: services
jaimes-mbp:SMR jaimemontoya$
Isn't brew the command, and services only a parameter? I am not understanding why the error says that services is an unknown command. Thank you.
UPDATE 1: I see two warnings when I try to run brew install mongodb-community#4.2 again. Maybe that has something to do with the problem?:
jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community#4.2
Warning: mongodb/brew/mongodb-community-4.2.3 already installed
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
UPDATE 2: When I use mongo, it is doing something:
jaimes-mbp:SMR jaimemontoya$ mongo
MongoDB shell version v4.2.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-03-13T06:41:22.073-0600 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect#src/mongo/shell/mongo.js:341:17
#(connect):2:6
2020-03-13T06:41:22.076-0600 F - [main] exception: connect failed
2020-03-13T06:41:22.076-0600 E - [main] exiting with code 1
jaimes-mbp:SMR jaimemontoya$
Maybe I do not need to use brew services start mongodb-community#4.2? I thought it was necessary to run MongoDB Community Edition.
UPDATE 3: I run ps aux | grep -v grep | grep mongod and it returns nothing. I am trying to verify that MongoDB is running, so I am searching for mongod in my running processes but it returns nothing, meaning that MongoDB is not running I guess.
UPDATE 4: See what happens when I run brew doctor --verbose:
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.
Warning: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
You should probably change the ownership and permissions of /usr/local
back to your user account.
sudo chown -R $(whoami):admin /usr/local
When I run sudo chown -R $(whoami):admin /usr/local, I get this:
jaimes-mbp:SMR jaimemontoya$ sudo chown -R $(whoami):admin /usr/local
Password:
chown: /usr/local: Operation not permitted
jaimes-mbp:SMR jaimemontoya$
brew update is not working:
jaimes-mbp:SMR jaimemontoya$ brew update
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
You should probably change the ownership and permissions of /usr/local
back to your user account.
sudo chown -R $(whoami):admin /usr/local
jaimes-mbp:SMR jaimemontoya$
Seems like you are facing issue with brew.
Run brew doctor --verbose to check if the brew is working fine.
And then brew update to update the brew version.
After this run, brew services list to display all the services in the brew.
If you see mongodb-community#4.2 there in the list, then run brew services start mongodb-community#4.2
It should work.
I followed the advice MikeMcQuaid provided at https://github.com/Homebrew/brew/issues/3665:
You need to uninstall and install Homebrew using
https://github.com/Homebrew/install
As explained at https://github.com/Homebrew/install, I first ran /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)". After that I ran /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)".
Then I ran this:
jaimes-mbp:SMR jaimemontoya$ brew tap mongodb/brew
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.
==> Tapping mongodb/brew
Cloning into '/usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew'...
remote: Enumerating objects: 86, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (76/76), done.
remote: Total 145 (delta 41), reused 21 (delta 10), pack-reused 59
Receiving objects: 100% (145/145), 30.18 KiB | 2.16 MiB/s, done.
Resolving deltas: 100% (68/68), done.
Tapped 6 formulae (33 files, 83.0KB).
jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community#4.2
==> Installing mongodb-community from mongodb/brew
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.3.tgz
######################################################################## 100.0%
==> Caveats
To have launchd start mongodb/brew/mongodb-community now and restart at login:
brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf
==> Summary
🍺 /usr/local/Cellar/mongodb-community/4.2.3: 21 files, 304.3MB, built in 1 minute 54 seconds
jaimes-mbp:SMR jaimemontoya$ brew services start mongodb-community#4.2
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 88, done.
remote: Counting objects: 100% (88/88), done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 691 (delta 31), reused 69 (delta 25), pack-reused 603
Receiving objects: 100% (691/691), 192.79 KiB | 1.68 MiB/s, done.
Resolving deltas: 100% (270/270), done.
Tapped 1 command (39 files, 266.3KB).
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
jaimes-mbp:SMR jaimemontoya$ ps aux | grep -v grep | grep mongod
jaimemontoya 17763 0.1 0.2 5544164 38300 ?? S 8:11AM 0:00.65 /usr/local/opt/mongodb-community/bin/mongod --config /usr/local/etc/mongod.conf
jaimes-mbp:SMR jaimemontoya$
It works!
DockerFile
FROM node:8
EXPOSE 4200
RUN npm install
RUN npm install -g #angular/cli
docker-compose.yml
version: '3'
services:
node:
build: .
ports:
- 4200:4200
ng serve output inside docker container
* Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2019-01-30T10:28:28.001Z
Hash: b43d4abc7ff424082a0f
Time: 13641ms
chunk {main} main.js, main.js.map (main) 11.5 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 236 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.4 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.75 MB [initial] [rendered]
ℹ 「wdm」: Compiled successfully.
What do I miss? I can't access http://localhost:4200/
Use docker-compose run -p 4200:4200 node bash to publish port 4200 and run bash on node service.
Pass --host 0.0.0.0 as argument for ng serve command.
I am trying to implement the BYFN Hyperledger example form my Windows 10 Linux Subsystem (Ubuntu Xenial). However, the ./byfn.sh -m up command fails with the following output:
$GOPATH/fabric-samples/first-network$ ./byfn.sh -m up
Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
2018-04-24 22:12:44.343 UTC [main] main -> INFO 001 Exiting.....
LOCAL_VERSION=1.1.0
DOCKER_IMAGE_VERSION=1.1.0
Creating peer0.org1.example.com ... done
Creating orderer.example.com ... done
Creating peer1.org1.example.com ... done
Creating peer0.org2.example.com ... done
Creating peer1.org2.example.com ... done
Creating cli ... done
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"scripts/script.sh\": stat scripts/script.sh: no such file or directory": unknown
ERROR !!!! Test failed
I see that only one container is built:
$GOPATH/fabric-samples/first-network$ dps
CONTAINER ID NAMES NETWORKS STATUS SIZE
3e66d31c6b9a cli net_byfn Up 27 minutes 17B (virtual 1.46GB)
From the output it seems that the cli container cannot see the script.sh script. Thinking this maybe a docker-compose volume-bind issue I tried to check the binds in the cli container:
$GOPATH/fabric-samples/first-network$ docker exec -ti cli bash
root#3e66d31c6b9a:/opt/gopath/src/github.com/hyperledger/fabric/peer# ls scripts/
root#3e66d31c6b9a:/opt/gopath/src/github.com/hyperledger/fabric/peer# exit
exit
$GOPATH/fabric-samples/first-network$ ls scripts/
capabilities.json script.sh step1org3.sh step2org3.sh step3org3.sh testorg3.sh upgrade_to_v11.sh utils.sh
Looking at the the docker-compose-cli.yaml file I see the following binds for the cli container:
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/chaincode
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
My Docker settings:
$GOPATH/fabric-samples/first-network$ docker version
Client:
Version: 18.03.0-ce
API version: 1.37
Go version: go1.9.2
Git commit: 0520e24
Built: Wed Mar 21 23:05:52 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 0520e24
Built: Wed Mar 21 23:14:32 2018
OS/Arch: linux/amd64
Experimental: false
$GOPATH/fabric-samples/first-network$ docker-compose version
docker-compose version 1.21.0, build 5920eb0
docker-py version: 3.2.1
CPython version: 3.6.5
OpenSSL version: OpenSSL 1.0.1t 3 May 2016
My Go version:
$GOPATH/fabric-samples/first-network$ go version
go version go1.10.1 linux/amd64
Wondering if I'm missing something. I should mention that I used the following command to start form scratch, based on a fresh set of images (no prior images) as outlined in this script:
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s 1.1.0
Thanks
Its most probably the version of golang---Fabric needs go version 1.9.x and the error message exec failed: container_linux.go:348: indicates the same thing.
In my case, it was the first Note on this page https://hyperledger-fabric.readthedocs.io/en/latest/install.html
I'm running on Windows 10, but Docker won't work since i need Windows 10 Pro or better to run it. So i'm using Docker Toolbox, and must follow the Windows 7 trick of cloning the sources anywhere under C:\Users
I'm trying to upgrade postgres locally so I don't get a version mismatch error. This is what i do:
echo "http://dl-5.alpinelinux.org/alpine/v3.5/main" >> /etc/apk/repositories;
apk update
bash-4.3# apk add postgresql-dev
(1/4) Installing libressl2.4-libtls (2.4.4-r0)
(2/4) Installing libressl-dev (2.4.4-r0)
(3/4) Installing postgresql-libs (9.6.5-r0)
(4/4) Installing postgresql-dev (9.6.5-r0)
Executing busybox-1.24.2-r13.trigger
OK: 353 MiB in 108 packages
bash-4.3# pg_dump
bash: /usr/bin/pg_dump: No such file or directory
I'm at a loss - any idea what the problem is please?
Just a guess but I guess you've not installed postgresql. In order to use the pg_dump you must have installed this, or if you do have it already and I'm wrong try reinstalling it like so:
bash-4.3# apk del postgresql
(1/4) Purging postgresql (9.6.5-r0)
(2/4) Purging postgresql-client (9.6.5-r0)
(3/4) Purging libedit (20170329.3.1-r2)
(4/4) Purging libxml2 (2.9.4-r4)
Executing busybox-1.26.2-r5.trigger
OK: 37 MiB in 25 packages
bash-4.3# apk add postgresql
(1/4) Installing libedit (20170329.3.1-r2)
(2/4) Installing postgresql-client (9.6.5-r0)
(3/4) Installing libxml2 (2.9.4-r4)
(4/4) Installing postgresql (9.6.5-r0)
Executing busybox-1.26.2-r5.trigger
OK: 53 MiB in 29 packages
bash-4.3# pg_dump
pg_dump: [archiver (db)] connection to database "root" failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
bash-4.3#
As you can see from above pg_dump is working because it is in the postgresql package even though as listed on alpine packages site it should be within the postgresql-client package as shown here but it doesn't work unless postgres is installed. If you can't have a full postgres installation, I recommend this workaround which is a bit unclean, install postgres, backup the pg_dump binary, uninstall postgres then restore pg_dump like so:
bash-4.3# apk add postgresql
(1/2) Installing libxml2 (2.9.4-r4)
(2/2) Installing postgresql (9.6.5-r0)
Executing busybox-1.26.2-r5.trigger
OK: 53 MiB in 29 packages
bash-4.3# cp /usr/bin/pg_dump /usr/bin/pg_dump
pg_dump pg_dumpall
bash-4.3# cp /usr/bin/pg_dump /usr/bin/pg_dump.back
bash-4.3# cp /usr/bin/pg_dumpall /usr/bin/pg_dumpall.back
bash-4.3# apk del postgresql
(1/2) Purging postgresql (9.6.5-r0)
(2/2) Purging libxml2 (2.9.4-r4)
Executing busybox-1.26.2-r5.trigger
OK: 38 MiB in 27 packages
bash-4.3# mv /usr/bin/pg_dump.back /usr/bin/pg_dump
bash-4.3# mv /usr/bin/pg_dumpall.back /usr/bin/pg_dumpall
bash-4.3# pg_dump
pg_dump: [archiver (db)] connection to database "root" failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
bash-4.3#
It is not ideal but it has worked for me in the past
I have this Docker command:
docker run -d mongo
this will build and run a mongodb server running in a docker container
However, I get an error:
no space left on device
I am on MacOS, and using the newer versions of Docker which use hyper-v instead of VirtualBox (I think that's correct).
Here is the exact error message from the mongo container:
$ docker logs efee16702c5756659d563b98d4ae0f58ecf1f1bba8a54f63443c0ae4b520ab4e
about to fork child process, waiting until server is ready for connections.
forked process: 21
2017-05-04T20:23:51.412+0000 I CONTROL [main] ***** SERVER RESTARTED *****
2017-05-04T20:23:51.430+0000 I CONTROL [main] ERROR: Cannot write pid file to /tmp/tmp.Lo035QkbfL: No space left on device
ERROR: child process failed, exited with error number 1
Any idea how to fix this and prevent it from happening in future?
As suggested, the output of df -h is:
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk1 465Gi 116Gi 349Gi 25% 1963838 4293003441 0% /
devfs 183Ki 183Ki 0Bi 100% 634 0 100% /dev
map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net
map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home
Output of docker info is:
$ docker info
Containers: 5
Running: 0
Paused: 0
Stopped: 5
Images: 741
Server Version: 17.03.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.13-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952 GiB
Name: moby
ID: OR4L:WYWW:FFAP:IDX3:B6UK:O2AN:UVTO:EPH6:GYSV:4GV4:L5WP:BQTH
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 17
Goroutines: 30
System Time: 2017-05-04T20:45:27.056157913Z
EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
As you state in the comments to the question, ls -altrh ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 returns the following:
-rw-r--r--# 1 alexamil staff 53G
This is a known bug on MacOS (actually, not only) and an official dev comment could be found here. Except for one thing: I read, that different people get different size limit. In the comment it is 64Gb, but for another person it was 20Gb.
There are a couple walkarounds, but no definite solution that I could find.
The manual one
Run docker ps -a and manually remove all unused containers. Then run docker images and remove manually all the intermediate and unused images.
The simplest one
Delete the Docker.qcow2 file entirely. But you will lose all images and containers. Completely.
The less simple
Another way is to run docker volume prune, which will remove all unused volumes
The resizing one (keeps the data)
Another idea that comes to me is to expand the disk image size with QEMU or something like it:
$ brew install qemu
$ /Applications/Docker.app/Contents/MacOS/qemu-img resize ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 +5G
After you expanded the image, you will need to run a VM in which you should run GParted against Docker.qcow2 and expand the partition to use added space. You could use GParted Live ISO for that:
$ qemu-system-x86_64 -drive file=Docker.qcow2 -m 512 -cdrom ~/Downloads/gparted-live.iso -boot d -device usb-mouse -usb
Some people report this either doesn't work or doesn't help.
Yet another resizing one (wipes the data)
Create a substitute image with desired size (120G):
$ qemu-img create -f qcow2 ~/data.qcow2 120G
$ cp ~/data.qcow2 /Application/Docker.app/Contents/Resources/moby/data.qcow2
$ rm ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
data.qcow2 is copied to ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2 when you restart docker.
This walkaround comes from this comment.
Hope this helps. Good luck!