How to restart Docker-for-mac with command? - macos

I'm using Docker for mac.
I'd like to restart this Docker-for-mac App with command on Terminal.
What's the command?
There was no documentation for this.
I had do restart it by clicking that button anytime that I needed to.

Forcing Docker for Mac to re-read its config with
killall -HUP com.docker.hyperkit
might work - if it doesn't, please explain in more detail why you need to restart Docker in the first place.

For me I needed to restart Docker so I could install the new version
killall Docker did the trick.

Related

Cannot find the docker container running on port 80, tried everything usual

What happened:
I ran a container (vuejs-build website on a httpd:2.4) from shell (oh my zsh) on mac OS 11.2.2 using the previous docker release.
Then I updated the mac OS docker desktop.
Now the container is running but it's not showing on docker ps -a or docker container ls -a. I cannot find the process no matter what I try. Tried all the ps aux commands with grep, all lsof -wahtever, finding it in activity tool on mac. Even restarting the mac or stopping docker deamon does not stop it.
Has anybody a clue how to find it? I can open and refresh the webpage that is running in the container.
Docker version now says: Docker version 20.10.5, build 55c4c88.
PLEASE HELP!!
I solved it myself:
The container was stuck but restart seemed to have actually killed it.
However:
I realized that assets such as images are not being loaded despite JS and CSS is.
So I tried starting another httpd instance with docker run -p 80:80 httpd and reloaded. Firstly the same site as before appeared. But being able to start another httpd got me thinking.
The I opened dev tools in my browser. That disables Cache (using Chrome). Another hit on refresh then showed the "It works" page from httpd.
Some researching gave me the following theory: Vuejs stores the compiled Markup, JS and CSS on your browsers persistence storage. Probably for performance.

Kubernetes not starting in docker for Mac

I am running docker for Mac in latest Mojave. Tried to enable Kubernetes from the preferences. Since then the message is just 'kubernetes is starting'. But it never completes. I am confused as to what has to be done.
Is there anything that I need to change in the network config part?
Just before this, I tried a failed attempt of installing Minikube in the same machine.
I had this same issue on MacOS Catalina. Resetting to factory defaults did finally resolve the issue for me.
Select Troubleshoot from the drop down menu or preferences and click the bug. Then select Reset to factory defaults.
Obviously this is a destructive solution, so use with care.
For me was very useful:
stop docker for desktop
remove the folder ~/Library/Group\ Containers/group.com.docker/pki
rm -rf ~/Library/Group\ Containers/group.com.docker/pki
start docker for destkop
Found the solution here

PyCharm Docker Compose Debug Django

I've followed Jetbrains tutorial for setting up Docker Compose with remote python interpreter on Mac OS
https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html#debug
Everything works well - starting and composing services, manage.py commands etc. apart from debugging. Pycharm just won't stop on specific breakpoint and prints in PyCharm status bar - "Waiting for connection"
Did anyone experienced same issue?
This has happened to me, running docker network prune (to force docker to remap ips), then doing "invalidate cache and restart" has worked for me.

Can I just kill mongod to stop mongo?

I am very new at Mongo. I am running mongod as described here in Mac OS X. I am running two mongod processes from the command line. If I need to stop the mongod processes I just execute kill <pid of mongod>. Is it the recommended way to stop mongod?
It finally succeeded (Ubuntu 15.04) with
//1.find process by name:
$ pgrep mongo
1350
//2.kill mongod-process
$ kill 1350
This is quite late, but I had same problem now, and I found one easy way :
Esan-iMac:~$mongo admin --eval "db.shutdownServer()"
MongoDB shell version: 2.6.4
connecting to: admin
2015-02-19T10:54:22.574+0200 DBClientCursor::init call() failed
server should be down...
It's giving some odd messages, but it works.
And I made alias-command for running it easy.
alias stop-mongo='/opt/mongo/release/bin/mongo admin --eval "db.shutdownServer()"'
This works at least if you start your mongo manually (e.g. with --fork option).
The accepted answer by Esa is correct. Also, regarding whether using kill is recommended - yes, but with flag -2 or no flag, never use -9. As mentioned in docs.
kill -2 `pgrep mongo`
Alias
alias stopmongo='kill -2 `pgrep mongo`'
Windows
use admin
db.shutdownServer()
For systems with auth enabled, users may only issue db.shutdownServer() when authenticated to the admin database or via the localhost interface on systems without authentication enabled.
Linux
mongod --shutdown
you can also use
kill <mongod process ID>
see http://docs.mongodb.org/manual/tutorial/manage-mongodb-processes/
For year of 2020:
Mongo should be installed through Brew, rather than the old school style on linux: i.e. tar.gz package download/uncompress/configure/run.
In the brew way, if Mongo is installed by brew tap mongodb/brew and brew install mongodb-community, you could do as follows to stop (and disable) it alike Systemd on Linux.
~ brew services list
Name Status User Plist
mongodb-community started zhengxin /Users/zhengxin/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
~ brew services stop mongodb-community
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
terminal$ kill $(pgrep mongod)
this command can help killing the mongod process. sudo pkill -f mongod
Just encountered an issue with "just killing the mongod" in mac...
The mongod is kept running as a service by "launchctl" in mac systems. "just killing" it will kill that service.
Now to use mongo shell we do mongod again, however for other development purpose like connecting from node we need to make sure to run mongod time and again.
Other alternative is shut down the system and start again.
Better Way :
Start using launchctl to manage such services. Here is an example for that :
What is the correct way to start a mongod service on linux / OS X?
The easiest way is Ctrl + C, which worked for me on a blocking bash shell under El Capitan.
If you have configured autostart, killing the process won't help, new one will start immediately. In order to disable autostart, you have to locate the autostart file first. You can try to find the file using e.g.
find / -name "mongodb.plist" or locate "mongodb.plist"
After the file is found, remove the autostart config using (you can try without sudo first, it's not needed if you have done the installation using Homebrew):
sudo launchctl unload -w <file>
If you want to kill the process anyway and it's not using autostart, remember not to use kill -9 <PID>, it can damage the db. kill -1 <PID> or kill -15 <PID> should be safe options.
https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes/
official guide
remember not to use kill -9
otherwise maybe you need to remove lock file in dbpath

How do I start MariaDB on boot on Mac OS X?

Just installed MariaDB (with homebrew). Everything looks like it's working, but I can't figure out how to have it automatically startup on boot on my Mac. I can't find any Mac-specific docs for this.
The installation output says:
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
I guess I don't know where the right place is.
From brew info mariadb
To have launchd start mariadb now and restart at login:
brew services start mariadb
Or, if you don't want/need a background service you can just run:
mysql.server start
Just run brew services start mariadb on terminal.
With help from Calvin's answer (deleted, I guess?), and this page, these are the steps I used to accomplish this:
cp /usr/local/Cellar/mariadb/5.5.30/homebrew.mxcl.mariadb.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
On next boot, MariaDB was up and running.
If you install MariaDB by Homebrew, you can use this to see how to start your mariadb at login.
brew info mariadb
To have launchd start mariadb at login:
ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents
Then to load mariadb now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
You need to use launchd. See $ man launchd.
Additionally, Nathan wrote a good article on launchd.

Resources