$ sudo usermod -aG docker user
$ sudo systemctl start docker
$ docker run hello-world
docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.See 'docker run --help'.
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
hello-world イメージを削除する
動作確認したかっただけなので、 hello-world イメージは削除しましょ。
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
97908c7b341c hello-world "/hello"3 minutes ago Exited (0)3 minutes ago peaceful_nash
$ sudo docker stop 97908c7b341c
97908c7b341c
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest feb5d9fea6a5 17 months ago 13.3kB
$ sudo docker rmi feb5d9fea6a5
Error response from daemon: conflict: unable to delete feb5d9fea6a5 (must be forced) - image is being used by stopped container 97908c7b341c
#=> 複数のタグがついているので削除できないので、削除を強制する必要がある
$ sudo docker rmi -f feb5d9fea6a5
Untagged: hello-world:latest
Untagged: hello-world@sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb
Deleted: sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412
❯ docker run -v /tmp/lima:/data -p 27017:27017 mongo:6.0.4
WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
see https://jira.mongodb.org/browse/SERVER-54407
see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814
これは docker を動かす lima のバックエンドである qemu が AVX をサポートしていないから、らしい。
At the moment, running natively on Apple M1 is referring to using Rosetta 2 without Docker (for example, installing the macOS x86_64 binaries via brew 48). The macOS packages are working fine for me on M1 with Rosetta 2 installed.
で、なんで M1 + Lima (x86_64) の Docker で動かないかと言うと以下とのこと。
This discussion was originally about someone trying to run the Linuxx86_64 binaries in Docker on M1, which will be problematic because of the requirement for AVX support in MongoDB 5.0 packages for Linuxx86_64 39. The solution for the original question would be to either install MongoDB 4.4 packages on Linux (since those are not optimised for AVX) or to build MongoDB 5.x from source 22 with an older x86_64 CPU architecture target.
Building the MongoDB server with ARM64/aarch64 support for MacOS (SERVER-50115 106) is currently blocked pending resolution of a SpiderMonkeyJavaScript engine upgrade (SERVER-42427 61).
==> Installing mongodb/brew/mongodb-community
==> Caveats
To 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 /opt/homebrew/etc/mongod.conf
==> Summary
🍺 /opt/homebrew/Cellar/mongodb-community/6.0.4: 10 files, 199.9MB, built in 2 seconds
==> Running `brew cleanup mongodb-community`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /opt/homebrew/Cellar/mongodb-community/6.0.1... (10 files, 199.6MB)
==> Caveats
==> mongodb-community
To 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 /opt/homebrew/etc/mongod.conf