Docker For Mac Start On Boot10/13/2021
These worked for both VNC and SSH.For VNC, navigating to vnc://ip.address.here in Safari opened the macOS Screen Sharing app and prompted me to connect. AWS haven't launched this yet (at least anywhere I could find it), and Scaleway were out of stock on their machines which you can rent by the day, so I tried using a $109/month M1 Mac Mini from MacStadium.The machine became available within a minute of me entering the card details, and gave me an IP address I could connect to plus an administrator account username and password. Run macOS Big Sur or Catalina using Docker-OSX (for other options.TLDR: Use platform: linux/amd64 in docker-compose.yml and your containers will probably work!I was trying to figure out how to get a development environment for a Django project running inside Docker in a M1 Mac.Since I don't have an M1 Mac, I decided to rent one. Integrate with your favorite tools throughout your development pipeline - Docker works with all development tools you use including VS Code, CircleCI and GitHub.Simon Willison’s TILs Running Docker on an M1 MacTo start a reboot immediately from the Mac OS X Terminal, type the following command. Create your multi-container application using Docker Compose.
Docker Start On Boot Install Commands ThereThese both needed to be done not over SSH.Docker for Mac required Rosetta 2 - thankfully installing that is a case of running softwareupdate -install-rosetta - which for me only took a couple of seconds and displayed an error message which appeared not to matter at all, since Docker for Mac then started working fine.When I tried to run Docker containers with mounted volumes I ran into an issue where a UI prompt displayed on the macOS desktop stating that Docker wanted access to my filesystem - another reason to run the first set of commands over VNC rather than SSH.Eventually I got to a point where docker run commands were safe to run via SSH instead of a terminal over VNC. I then installed Docker using brew install -cask docker. I ended up having to turn the machine off through the MacStadium web interface, waiting a while and then turning it back on again in order to clear the errors (a soft reboot didn't help).So be sure to open a terminal in the Screen Sharing app over VNC and run the install commands there.Pasting in the installation command from did the trick. Installing Homebrew and DockerFirst, most important lesson: do not attempt to install these large pieces of software over SSH! Both of these had points within the install process that triggered desktop UI interactions of some sort, and trying to start them over SSH lead to a bewildering array of permission errors.I still get random compiler errors from macos version mismatches on big sur.Which made me feel a little bit better about being defeated! Until. Apple Python and homebrew Python and the different types of pyenv pythons and different cpu archs add completely new sources of frustration and errors. /manage.py runserver 0.0.0.0:3000File "/usr/local/lib/python3.8/site-packages/django/core/management/_init_.py", line 419, in execute_from_command_lineFile "/usr/local/lib/python3.8/site-packages/django/core/management/_init_.py", line 413, in executeSelf.fetch_command(subcommand).run_from_argv(self.argv)File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argvFile "/usr/local/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 61, in executeFile "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 398, in executeFile "/usr/local/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 96, in handleFile "/usr/local/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 103, in runAutoreload.run_with_reloader(self.inner_run, **options)File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 640, in run_with_reloaderThat free(): invalid pointer error completely stumped me, since it didn't come with a detailed enough stacktrace that I could figure out which dependency (I have a hunch it was caused by a C deopendency) was causing it, and I couldn't figure out debugging techniques from searching the internet.M1 macs add a whole new world of crazy to Python. Inside a Docker container seemed to work for most packages - I upgraded to FROM python:3.9-buster as my base image and was able to run apt-get install python-psycopg2 to talk to PostgreSQL.The I ran into this error on container startup: docker run -it -v "$(pwd):/app" vial_web python -i. Python dependencies using wheels such as psycopg2-binary failed to install. And then I almost gave up.Getting things to work in Docker on an M1 is really, really hard.![]() And it turns out you can tell Docker for Mac to build and run containers using the linux/amd64 architecture and everything.
0 Comments
Leave a Reply.AuthorBrandon ArchivesCategories |