Changed Mac homefolder name, Docker doesn't start - macos

I have renamed my home folder name (let's say from userA to userB) and Docker stopped working.
The error is:
Cannot create/resize "/Users/userA/Library/Containers/com.docker.docker/Data/com.dockser.driver.amd64-linux/Docker.qcow2":exit status 1"
Notice that the path it shows is to the old folder name, userA. I have uninstalled and reinstalled Docker CE from the docker store (https://store.docker.com/editions/community/docker-ce-desktop-mac) but still have the same error.
Why is it still using the old folder even after I uninstalled?

You need a clean setup.
WARNING: the below procedure will delete all of your containers and images❗️
Try to delete following folders: some of them may require sudo privileges.
~/.docker
~/Library/Containers/com.docker.docker
~/Library/Group\ Containers/group.com.docker
~/Library/Caches/com.docker.docker
~/Library/PrivilegedHelperTools/com.docker.vmnetd
~/Library/Preferences/com.docker.docker.plist

I know this is old and would prefer not to rez it, but this answer came up when searching Google and I found a better solution that doesn't require you do delete anything - which I felt would be useful for anyone who comes across this question.
Assuming the old name is UserA, and the new is UserB
Create a new UserA directory in /Users/, then all the directories in the "missing" file path. IE: Library/Containers/com.docker.docker/Data/com.dockser.driver.amd64-linux/
Move Docker.qcow2 from UserB/Library/Containers/com.docker.docker/Data/com.dockser.driver.amd64-linux/ to the directory created in step 1.
Start Docker
Open Docker preferences -> Go to the Disk menu
Select "Move Disk Image" and pick the new location to move that docker file into. IE: you'll want to move it to UserB/Library/Containers/com.docker.docker/Data/com.dockser.driver.amd64-linux/

Related

kubectl not working on my windows 10 machine

When I try to run any kubectl command including kubectl version, I get a pop-up saying "This app can't run on your PC, To find a version for your PC, check with the software publisher" when this is closed, the terminal shows "access denied"
The weird thing is, when I run the "kubectl version" command in the directory where I have downloaded kubectl.exe, it works fine.
I have even added this path to my PATH variables.
thank you for the answer, #rally
apparently, in my machine, it was an issue of administrative rights during installation. My workplace's IT added the permission and it worked for me.
Adding this answer here so that if anyone else comes across this problem they can try this solution as well.
Not knowing what exactly you downloaded, i would suggest you to delete everying in the folder and follow the instructions for installing kubectl for Windows from here:
https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/
Note: downloading the .exe is not enough. You need a kubeconfig file "config", which contains the configuration to access your cluster.
kubectl looks for this file in a hidden folder under your user profile directory. c:\users<me>.kube.
Just to let you try, i would suggest you to activate Kubernetes in your Docker-Desktop installation. I guess you have this installed. If not install it from the Dockersite. https://www.docker.com/products/docker-desktop/
Activating Kubernetes inside Docker-desktop, will install also kubectl and save the config in the .kube folder.
After the installation finished, in a new terminal:
kubectl get node
You should see the 1 node in the kubernetes-docker-desktop cluster.
Now if you want to access another cluster, you need the kubeconfig-file for that cluster. If you have it, just rename the config in the .kube folder (to not loose it) and put the other config inside.
If the new config file is correct you should be able to access that cluster.
The config file can be structured to hold more than one cluster configuration and you can switch between them using a so called context.
Here you can get the information how to do that, according to your needs:
https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/
Hope this can help you, starting with KUbernetes.

How to change Docker Image location on Windows 10 Home [duplicate]

I am using docker toolbox on Windows 7 to run docker. (docker version 1.9.1)
As it turns out, the docker machine creates its VM at C:\Users\username\.docker\machine\machines\default. As I commit the images, the size of VM at this location bloats up. Since it's Windows, I can't afford the luxury of space on the C drive.
Is there any way I can change the location of the default machine?
You can move .docker directory to another drive and create a junction point to it.
Please note that regular shortcut will not work.
For example:
Move .docker directory from C:\Users\username to D:\
and run:
C:\Users\username>mklink /j .docker D:\.docker
Junction created for .docker <<===>> D:\.docker
This is what worked perfectly for me on Windows 7:
Setup the MACHINE_STORAGE_PATH environment variable as the root of the location you want to use for the Docker machines/VMs, cache, etc.
Install Docker Toolbox
Run Docker Quickstart Terminal
Docker Toolbox will now create all the files at the location pointed at by MACHINE_STORAGE_PATH.
UPDATE:
Note that creating a new VM with the new storage path is not ideal, as the Docker Quickstart Terminal scripts don't seem to work with anything not named "default".
If you've already got a VM sitting in the C: drive, then the simplest thing to do would be to go to Oracle VirtualBox and delete the "default" VM, uninstall Docker Toolbox, delete C:\Users\<username>.docker\, and then follow the 3 steps above.
Note: uninstalling and reinstalling Docker Toolbox may not be required. But I haven't tested without it.
Update
To move Docker certificates also, set the DOCKER_CERT_PATH variable to point to the path of the new drive. Thanks to #Nutle for the tip.
Since 2015, there is now (June 2017) Hyper-V, which allows you to define where you want your VHDX files:
See Docker for Windows 1.13.0, 2017-01-19 (stable):
VHDX file containing images and non-host mounted volumes can be moved (using “advanced” tab in the UI)
That will modify the %APPDATA%\Docker\settings.json with a line:
"MobyVhdPathOverride":"C:\\Users\\Public\\Documents\\Hyper-V\\New folder\\MobyLinuxVM.vhdx"
See this thread for more.
Original answer
Currently 2015 , docker-machine forces the use of %USERPROFILE%:
See libmachine/mcnutils/utils.go#L17-L25
As commented in issue 499:
In the meantime, how will users be able to specify where the .docker/machine/* files are stored?
you can by specifying --storage-path on the command line or using the environment variable MACHINE_STORAGE_PATH.
(You can see it implemented in PR 1941)
Joost Den Boer points out in the comments
Just tried '-s <path>' on a Mac and it seems to work fine.
What might not be obvious is that the path option goes before the command.
Running "docker-machine -s /Volumes/other/location' create --driver=virtualbox" created a new VirtualBox image at the other location.
Simply use the VirtualBox graphic interface to relocate the file disk.vmdk:
Copy file C:\Users\{myUsername}\.docker\machine\machines\default\disk.vmdk into another folder, say F:\docker-image\.
Open VirtualBox, select default VM and open Settings.
Open Storage, select current disk.vmdk and release it (or delete it).
Click on Choose Virtual Hard Disk File... and search for copied file in F:\docker-image\
A Warning occurs: VirtualBox complains of old VM UID then go to menu File, select Virtual Media Manager... and release or remove old disk.vmdk
Retry 4., it's done!
If required by your environment then do the relocation also for boot2docker.iso, Snapshot Folder, Video Capture.
Put these two commands when running docker quick start terminal.
I suppose that your new location is "D:\docker" and your new machine name is "docker1"
export MACHINE_STORAGE_PATH=D:\\docker
docker-machine create --driver=virtualbox docker1
This should create a new machine with specified name in your new location.
I could not get the MACHINE_STORAGE_PATH environment variable method working. It kept complaining about missing certificates when first initialising the machine. Still on Windows 7 so have to use docker-toolbox.
I got around the issue by:
Uninstalling Docker Toolbox and restarting machine
Open up Administrator prompt (Find command prompt, hold shift, choose "Run As Administrator")
Deleting .docker from %USERPROFILE%: rmdir /S %USERPROFILE%.docker
Create folder called .docker elsewhere: mkdir a:\.docker
mklink /J %USERPROFILE%.docker a:\.docker
Close Admin command prompt
Reinstall Docker Toolbox
Use the Docker Quickstart Terminal link to bootstrap everything.
Kitematic can be opened now too (though I had to choose the "Use Virtual Box" option on first error.
I have had a bit of trouble with any of the solutions above but this is what worked for me:
define the MACHINE_STORAGE_PATH environment variable to point to your desired
directory/folder.
Install docker-toolbox as normal, if this works for you then fine, but for me it was still installing inside .docker directory.
To fix this I have then stopped and removed the default machine that was created along with .docker folder from the Users directory.
Edited the start.sh script and added the line at the top:
e.g.
export MACHINE_STORAGE_PATH=D:\\Docker
Run the Docker Quickstart Terminal Shortcut, which rebuilt the default machine inside the desired folder
This answer is for people using Docker Toolbox (Windows 10 Home Build 1909, You can follow below steps for docker installation and then location change. I am not adding any images)
Install Docker Toolkit and VM must be installed with Admin Privileges after the installation of docker toolkit (*because Docker Toolkit also installs VM but it's of lower version and creates a problem with other iso files, u can uncheck also, in that case, *). Now we have to change the location of disk.vmdk and update the new location in VM.
Install Docker Toolbox from here. Follow the instructions provided
Now Download Virtual Machine v6+
Install Virtual Machine as Administrator (By Right-clicking and selecting there)
Goto place where your VirtualBox.exe(Not the installer) is present and right-click on it (you can find from the shortcut created on your Desktop)
goto properties --> compatibility --> change setting for all users --> select run this program as administrator
Now close the VM if it's running and run the Kitematic, If it fails (it will probably) then select option provided related to VM (only 2 options are there)
This time it will work, now close it
Changing the Location where Images will be downloaded
open your VM and close a newly running image default (right-click -> close --> power off)
copy paste your disk.vmdk file (for me it's present at C:\Users\Dell\.docker\machine\machines\default\disk.vmdk) to a place where you want to store your images that you download (basically disk.vmdk is what will grow in size when you are using docker)
Now we need to tell the VM also about this change
Right-click default image and goto settings
Select Storage
remove disk.vmdk attachment by right-clicking --> remove (that was the older path binded disk.vmdk)
click on file --> virtual media manager and remove disk.vmdk from here also (Now VM don't know if such a disk.vmdk thing exsists)
Right-click default image --> storage --> add hard disk (this option is just above that iso image)
Now select that disk.vmdk that you have pasted somewhere
Now run your docker cli and then run this command docker run hello-world
If no error is there then it's all done
You can verify size by checking the sizes of those two vmdk disks and then pulling some new images
I have written a very descriptive answer starting from installation because I did face some issues and so wanted to make it highly straight forward for the others.
You can delete your disk.vmdk disk (older one) from your C drive if you want to
Create file called c:\programdata\docker\config\daemon.json with content below where e:\images is location where do you want to store all you images etc. restart docker.
{
"graph": "e:\\images"
}
This Worked like a charm
Reference - https://forums.docker.com/t/where-are-images-stored/9794/11
These answers are out of date, as of the latest release. The location is configurable in the Settings user interface.
https://github.com/docker/for-win/issues/333
I found lots of these answers were out of data, at least they did not work in my environment: win10 PRO, docker desktop community 2.0.0.3. Finally, I resolved this problem by this method:
uninstall docker
open Hyper-V manager (press WIN key and then enter "Hyper")
Change the default virtual hard disk locations in the Hyper-V settings (not on the VM settings) and confirm
install docker
check the disk image location in advanced options of docker settings
I use windows 10 and Docker desktop (community) Version 2.0.0.0, I want to move vhdx file to another Drive.
Right click over Docker Desktop -> Settings
then the Docker Desktop UI will open go to Advance -> Disk image location
just change the path to new destination, the whole process was smooth and fast for me - it's automatically copy the vhdx file from original path to new path restart docker and all work as expected
 
For windows 7:
copy paste your disk.vmdk file (for me it's present at C:\Users\name.docker\machine\machines\default\disk.vmdk) to a place where you want to store your images that you download (basically disk.vmdk is what will grow in size when you are using docker)
in Virtualbox Right-click default image and goto settings
Select Storage remove disk.vmdk attachment by right-clicking --> remove
click on file --> virtual media manager and remove disk.vmdk from here also
Right-click default image --> storage --> add hard disk (this option is just above that iso image)Now select that disk.vmdk that you have pasted somewhere
change now this path in config.json (C:\Users\name.docker\machine\machines\default\config.json)
change the storage path with this new one where u put the location of your hard disk ( "StorePath": "F:\docker-image")
save.

All my Jenkins jobs and configs have disappeared after restart of my Mac

After updating macOS to Mojave (10.14.4), my Mac was restarted and upon opening Jenkins (at localhost:8080) it appeared that I've lost all my jobs and the entire system configurations.
There was only 1 user (admin) defined in my installation and my usual password was deemed invalid, when I tried to log back in. So, I tried entering another password I normally used and it was accepted. I then found that all my jobs and configs have disappeared. It looked as if I've just started Jenkins for the first time.
Looking through here on StackOverFlow, there were suggestions to check the JENKINS_HOME variable to find out where the jobs are saved on the disk, but when I typed export $JENKINS_HOME I just get an empty response. So, it looks like I've never configured it during set up.
I then dig through the hard drive and found the folders matching the names of the jobs I created under ~/.jenkins/workspace. However, the contents of all the folders are empty. I was expecting to see the usual files, e.g. build.xml, config.xml, etc.
I then did a global search for build.xml and config.xml on Mac Finder it turned up nothing.
Any idea where my jobs went and what could have caused all the contents of the folders of the jobs to be empty?
You can find your Jenkins installation directory in "Manage Jenkins" -> "configure System" --> "Home directory". Find what was the Jenkins home before you restart MAC. It looks like your home directory is either deleted by you or you are pointing to new folder now. Set it to earlier folder.
If can help,
I'm having a similar problem.
The curious part is about the new directory after the service restart ".jenkins" directory inside :
'/var/root/'.
And now, the password that Jenkins request me is not from
'/Users/username/.jenkins/secrets/initialAdministratorPassword' but from the newst one with same path pattern.
Simon

Change Docker machine location - Windows

I am using docker toolbox on Windows 7 to run docker. (docker version 1.9.1)
As it turns out, the docker machine creates its VM at C:\Users\username\.docker\machine\machines\default. As I commit the images, the size of VM at this location bloats up. Since it's Windows, I can't afford the luxury of space on the C drive.
Is there any way I can change the location of the default machine?
You can move .docker directory to another drive and create a junction point to it.
Please note that regular shortcut will not work.
For example:
Move .docker directory from C:\Users\username to D:\
and run:
C:\Users\username>mklink /j .docker D:\.docker
Junction created for .docker <<===>> D:\.docker
This is what worked perfectly for me on Windows 7:
Setup the MACHINE_STORAGE_PATH environment variable as the root of the location you want to use for the Docker machines/VMs, cache, etc.
Install Docker Toolbox
Run Docker Quickstart Terminal
Docker Toolbox will now create all the files at the location pointed at by MACHINE_STORAGE_PATH.
UPDATE:
Note that creating a new VM with the new storage path is not ideal, as the Docker Quickstart Terminal scripts don't seem to work with anything not named "default".
If you've already got a VM sitting in the C: drive, then the simplest thing to do would be to go to Oracle VirtualBox and delete the "default" VM, uninstall Docker Toolbox, delete C:\Users\<username>.docker\, and then follow the 3 steps above.
Note: uninstalling and reinstalling Docker Toolbox may not be required. But I haven't tested without it.
Update
To move Docker certificates also, set the DOCKER_CERT_PATH variable to point to the path of the new drive. Thanks to #Nutle for the tip.
Since 2015, there is now (June 2017) Hyper-V, which allows you to define where you want your VHDX files:
See Docker for Windows 1.13.0, 2017-01-19 (stable):
VHDX file containing images and non-host mounted volumes can be moved (using “advanced” tab in the UI)
That will modify the %APPDATA%\Docker\settings.json with a line:
"MobyVhdPathOverride":"C:\\Users\\Public\\Documents\\Hyper-V\\New folder\\MobyLinuxVM.vhdx"
See this thread for more.
Original answer
Currently 2015 , docker-machine forces the use of %USERPROFILE%:
See libmachine/mcnutils/utils.go#L17-L25
As commented in issue 499:
In the meantime, how will users be able to specify where the .docker/machine/* files are stored?
you can by specifying --storage-path on the command line or using the environment variable MACHINE_STORAGE_PATH.
(You can see it implemented in PR 1941)
Joost Den Boer points out in the comments
Just tried '-s <path>' on a Mac and it seems to work fine.
What might not be obvious is that the path option goes before the command.
Running "docker-machine -s /Volumes/other/location' create --driver=virtualbox" created a new VirtualBox image at the other location.
Simply use the VirtualBox graphic interface to relocate the file disk.vmdk:
Copy file C:\Users\{myUsername}\.docker\machine\machines\default\disk.vmdk into another folder, say F:\docker-image\.
Open VirtualBox, select default VM and open Settings.
Open Storage, select current disk.vmdk and release it (or delete it).
Click on Choose Virtual Hard Disk File... and search for copied file in F:\docker-image\
A Warning occurs: VirtualBox complains of old VM UID then go to menu File, select Virtual Media Manager... and release or remove old disk.vmdk
Retry 4., it's done!
If required by your environment then do the relocation also for boot2docker.iso, Snapshot Folder, Video Capture.
Put these two commands when running docker quick start terminal.
I suppose that your new location is "D:\docker" and your new machine name is "docker1"
export MACHINE_STORAGE_PATH=D:\\docker
docker-machine create --driver=virtualbox docker1
This should create a new machine with specified name in your new location.
I could not get the MACHINE_STORAGE_PATH environment variable method working. It kept complaining about missing certificates when first initialising the machine. Still on Windows 7 so have to use docker-toolbox.
I got around the issue by:
Uninstalling Docker Toolbox and restarting machine
Open up Administrator prompt (Find command prompt, hold shift, choose "Run As Administrator")
Deleting .docker from %USERPROFILE%: rmdir /S %USERPROFILE%.docker
Create folder called .docker elsewhere: mkdir a:\.docker
mklink /J %USERPROFILE%.docker a:\.docker
Close Admin command prompt
Reinstall Docker Toolbox
Use the Docker Quickstart Terminal link to bootstrap everything.
Kitematic can be opened now too (though I had to choose the "Use Virtual Box" option on first error.
I have had a bit of trouble with any of the solutions above but this is what worked for me:
define the MACHINE_STORAGE_PATH environment variable to point to your desired
directory/folder.
Install docker-toolbox as normal, if this works for you then fine, but for me it was still installing inside .docker directory.
To fix this I have then stopped and removed the default machine that was created along with .docker folder from the Users directory.
Edited the start.sh script and added the line at the top:
e.g.
export MACHINE_STORAGE_PATH=D:\\Docker
Run the Docker Quickstart Terminal Shortcut, which rebuilt the default machine inside the desired folder
This answer is for people using Docker Toolbox (Windows 10 Home Build 1909, You can follow below steps for docker installation and then location change. I am not adding any images)
Install Docker Toolkit and VM must be installed with Admin Privileges after the installation of docker toolkit (*because Docker Toolkit also installs VM but it's of lower version and creates a problem with other iso files, u can uncheck also, in that case, *). Now we have to change the location of disk.vmdk and update the new location in VM.
Install Docker Toolbox from here. Follow the instructions provided
Now Download Virtual Machine v6+
Install Virtual Machine as Administrator (By Right-clicking and selecting there)
Goto place where your VirtualBox.exe(Not the installer) is present and right-click on it (you can find from the shortcut created on your Desktop)
goto properties --> compatibility --> change setting for all users --> select run this program as administrator
Now close the VM if it's running and run the Kitematic, If it fails (it will probably) then select option provided related to VM (only 2 options are there)
This time it will work, now close it
Changing the Location where Images will be downloaded
open your VM and close a newly running image default (right-click -> close --> power off)
copy paste your disk.vmdk file (for me it's present at C:\Users\Dell\.docker\machine\machines\default\disk.vmdk) to a place where you want to store your images that you download (basically disk.vmdk is what will grow in size when you are using docker)
Now we need to tell the VM also about this change
Right-click default image and goto settings
Select Storage
remove disk.vmdk attachment by right-clicking --> remove (that was the older path binded disk.vmdk)
click on file --> virtual media manager and remove disk.vmdk from here also (Now VM don't know if such a disk.vmdk thing exsists)
Right-click default image --> storage --> add hard disk (this option is just above that iso image)
Now select that disk.vmdk that you have pasted somewhere
Now run your docker cli and then run this command docker run hello-world
If no error is there then it's all done
You can verify size by checking the sizes of those two vmdk disks and then pulling some new images
I have written a very descriptive answer starting from installation because I did face some issues and so wanted to make it highly straight forward for the others.
You can delete your disk.vmdk disk (older one) from your C drive if you want to
Create file called c:\programdata\docker\config\daemon.json with content below where e:\images is location where do you want to store all you images etc. restart docker.
{
"graph": "e:\\images"
}
This Worked like a charm
Reference - https://forums.docker.com/t/where-are-images-stored/9794/11
These answers are out of date, as of the latest release. The location is configurable in the Settings user interface.
https://github.com/docker/for-win/issues/333
I found lots of these answers were out of data, at least they did not work in my environment: win10 PRO, docker desktop community 2.0.0.3. Finally, I resolved this problem by this method:
uninstall docker
open Hyper-V manager (press WIN key and then enter "Hyper")
Change the default virtual hard disk locations in the Hyper-V settings (not on the VM settings) and confirm
install docker
check the disk image location in advanced options of docker settings
I use windows 10 and Docker desktop (community) Version 2.0.0.0, I want to move vhdx file to another Drive.
Right click over Docker Desktop -> Settings
then the Docker Desktop UI will open go to Advance -> Disk image location
just change the path to new destination, the whole process was smooth and fast for me - it's automatically copy the vhdx file from original path to new path restart docker and all work as expected
 
For windows 7:
copy paste your disk.vmdk file (for me it's present at C:\Users\name.docker\machine\machines\default\disk.vmdk) to a place where you want to store your images that you download (basically disk.vmdk is what will grow in size when you are using docker)
in Virtualbox Right-click default image and goto settings
Select Storage remove disk.vmdk attachment by right-clicking --> remove
click on file --> virtual media manager and remove disk.vmdk from here also
Right-click default image --> storage --> add hard disk (this option is just above that iso image)Now select that disk.vmdk that you have pasted somewhere
change now this path in config.json (C:\Users\name.docker\machine\machines\default\config.json)
change the storage path with this new one where u put the location of your hard disk ( "StorePath": "F:\docker-image")
save.

Where is IntelliJ IDEA config stored in OSX?

As part of a corporate workstation compliance effort, our IT department had to create a new user account for me on my Mac and left the old account until I transition all the artifacts and configs. So my old home directory was /Users/firstlast and the new one is /Users/flast. Of course, the burden of reconfiguring my environment fell on me.
Some of the apps that I use, such as ssh, Maven, Dropbox and DBeaver have their config conveniently and cleanly stored in the home directory (.ssh, .m2, .dropbox, .dbeaver, respectively) so migrating those was a cakewalk just copying the directory from the old home to the new using sudo and then chown. However, that is not the case with IntelliJ IDEA.
My IDEA was heavily customized to the extent that I would like to avoid doing it all over again if by all means possible. I understand that each project has its own config in the project directory but what I am after is to get the same list of projects to open when I launch IDEA under the new user as I did under the old user. All my projects were in ~/DEV (so ~/DEV/project1, ~/DEV/project2, etc and I can just copy the DEV directory from the old home to the new.
Where is this list of projects stored? I imagine it is somewhere in /private/etc or /private/var but permissioned to the old user so the new user does not see it.
This Jetbrains documentation lists where the important directories are:
http://devnet.jetbrains.com/docs/DOC-181
On Mac OS X IDEA uses the following directories:
Config: ~/Library/Preferences/IntelliJIdeaXX
System: ~/Library/Caches/IntelliJIdeaXX
Plugins: ~/Library/Application Support/IntelliJIdeaXX
Logs: ~/Library/Logs/IntelliJIdeaXX (starting from IntelliJ IDEA 9.0, older versions keep logs under System location)
While each project has its own config contained within the project directory, what you really want is when you first launch IDEA to get the same list of projects to choose from as before and just copying project directories will not do that.
Here are three easy steps to do it:
If your projects were in located in your old home directory, copy them into the new home directory and chown them to the new user. If they were located outside your old home directory, all you will need to do is chown them to the new user.
sudo cp -r /Users/${OLD_USER}/Library/Preferences/IdeaIC13 /Users/${NEW_USER}/Library/Preferences
sudo chown -R ${NEW_USER} /Users/${NEW_USER}/Library/Preferences/IdeaIC13
Ta-da-da. Open your IDE and it looks identical as before.

Resources