Possible to change where Android Virtual Devices are saved? - windows

I've set up the Android SDK and Eclipse on my machine running Windows XP and AVDs (Android Virtual Devices) are saved to "Documents and Settings\user\.android" by default. Is there any way to change this behavior? I have all of the other components saved in a directory on a separate partition and would like everything to be consolidated. Obviously not a huge deal but does anyone here know a workaround for this?

Add a new user environment variable (Windows 7):
Start Menu > Control Panel > System > Advanced System Settings (on the left) > Environment Variables
Add a new user variable (at the top) that points your home user directory:
Variable name: ANDROID_SDK_HOME Variable value:
a path to a directory of your choice
AVD Manager will use this directory to save its .android directory into it.
For those who may be interested, I blogged about my first foray into Android development...
Android "Hello World": a Tale of Woe
Alternatively, you can use the Rapid Environment Editor to set the environment variables.

Based on official documentation https://developer.android.com/studio/command-line/variables.html you should change ANDROID_AVD_HOME environment var:
Emulator Environment Variables
By default, the emulator stores configuration files under
$HOME/.android/ and AVD data under $HOME/.android/avd/. You can
override the defaults by setting the following environment variables.
The emulator -avd command searches the avd directory in the
order of the values in $ANDROID_AVD_HOME,
$ANDROID_SDK_HOME/.android/avd/, and $HOME/.android/avd/. For emulator
environment variable help, type emulator -help-environment at the
command line. For information about emulator command-line options, see
Control the Emulator from the Command Line.
ANDROID_EMULATOR_HOME: Sets the path to the user-specific emulator configuration directory. The default location is
$ANDROID_SDK_HOME/.android/.
ANDROID_AVD_HOME: Sets the path to the directory that contains all AVD-specific files, which mostly consist of very large
disk images. The default location is $ANDROID_EMULATOR_HOME/avd/.
You might want to specify a new location if the default location is
low on disk space.
After change or set ANDROID_AVD_HOME you will have to move all content inside ~user/.android/avd/ to your new location and change path into ini file of each emulator, just replace it with your new path

Modify the file "virtual_android2.2.ini" in "C:\Documents and Settings{your windows login}.android\avd\":
target=android-8
path=E:\android_workspace\avd\virtual_android2.2.avd
And move the folder "virtual_android2.2.avd" from "C:\Documents and Settings{your windows login}.android\avd\" into "E:\android_workspace\avd\".

Move your .android to wherever you want it to.
Then, create a symlink like this:
# In your home folder
$ ln -s /path/to/.android/ .
This simply tells Linux that whenever the path ~/.android is referenced by any application, link it to /path/to/.android.

Go to the Android tools directory. Edit the android.bat command file. At about the end of the command file, find a line similar to
call %java_exe% -Djava.ext.dirs=%java_ext_dirs% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir="%work_dir%" -jar %jar_path% %*
and replace
call %java_exe%
with
call %java_exe% -Duser.home={your_prefer_dir}
where {your_prefer_dire} is your preferred directory without braces but add doublequotes,
e.g.
call %java_exe% -Duser.home="E:\Program Files (x86)\android-sdk-windows"

For Visual Studio 2017 on Windows 10
Copy C:\Users\YOURUSERNAME\.android folder to (for example) E:\avd
Open the environment variables window:
Go into Settings and click on System.
On the left, click About and select System info at the
bottom.
In the new window, click Advanced system
settings on the left.
Click Environment Variables at
the bottom of the resulting window.
Add a new variable:
Variable name: ANDROID_SDK_HOME
Variable value: a path to a directory (e.g E:\avd)
Don't include .android in the variable value.
Restart Visual Studio.
For change SDK & NDK location go to:
Tools -> Options -> Xamarin -> Android Setting

You can change the .ini file for the new AVD:
target=android-7
path=C:\Users\username\.android\avd\VIRTUAL_DEVICE_NAME.avd
I don't know how to specify where the .ini file should be stored :)

In Windows 10 I had that problem because My C Drive was getting full and I had needed free Space, AVD folder had 14 gig space so I needed to move that folder to another driver, first answer not work for Me so I tested another way to fix it this problem,
I make a picture for you if you have the same problem, you don't need to move all of the files in .android folder to another drive (this way not work) just move avd folders in ....android\avd to another drive and open .ini files and change avd folder path from that file to the new path.
Like this image:
I hope this works for you.
Note: careful about a separate character before and after the path in ini file that you cannot see,if you remove that character it's not works

Check this out.
using the android command to create avd you can specify where to place files.
-p --path Location path of the directory where the new AVD will be created

The environmental variable ANDROID_AVD_HOME can be used to define the directory in which the AVD Manager shall look for AVD INI files and can therefore be used to change the location of the virtual devices;
The default value is %USERPROFILE%\.android\avd on Windows (or ~/.android/avd on Linux).
One can also create a link for the whole directory %USERPROFILE%\.android on Windows (or a sym-link for directory ~/.android on Linux).
When moving AVDs, the path entry in AVD INI file needs to be updated accordingly.

Another way to specify ANDROID_SDK_HOME without messing around with environment variables (especially when using ec2) is simply create a shortcut of eclipse and add the following as target
C:\Windows\System32\cmd.exe /C "setx ANDROID_SDK_HOME YOUR AVD PATH /M & YOUR ECLIPSE.EXE PATH"
This will set ANDROID_SDK_HOME as system variable whenever you launch eclipse.
HTH
Paul

Please take note of the following : modifying android.bat in the Android tools directory, as suggested in a previous answer, may lead to problems.
If you do so, in order to legitimately have your .android directory located to a non-default location then there may be an inconsistency between the AVDs listed by Android Studio (using "Tools > Android > AVD Manager") and the AVDs listed by sdk command line tool "android avd".
I suppose that Android Studio, with its internal AVD Manager, does not use the android.bat modified path ; it relies on the ANDROID_SDK_HOME variable to locate AVDs.
My own tests have shown that Android tools correctly use the ANDROID_SDK_HOME variable.
Therefore, there is no point, as far as I know, in modifying android.bat, and using the environment variable should be preferred.

there are major 4 steps
1. copy the .android folder to your desired location as i did in D:\Android\.android
2. set ANDROID_AVD_HOME in environment variables like ANDROID_AVD_HOME D:\Android\.android\avd
3. change avd name.ini file contents with new location like
avd.ini.encoding=UTF-8
path=D:\Android\.android\avd\Pixel_2_API_29.avd
path.rel=avd\Pixel_2_API_29.avd
target=android-29
4. restart android studio

1 - Move AVD to new Folder
2 - start Menu > Control Panel > System > Advanced System Settings (on the left) > Environment Variables
Add a new user variable:
Variable name: ANDROID_AVD_HOME
Variable value: a path to a directory of your choice
3 - Change the file .INI Set new folder.
4 - Open Android Studio
WORKS - Windows 2010
MORE INSTRUCTIONS : https://developer.android.com/studio/command-line/variables

In my case, what I concerned about is the C: drive disk space.
So what I did is copy the ".avd" folder(not file) to other drive, and leave the ".ini" file there but change it to point to the moved

I think the easiest way is to move the avd folder from C:\Users[USER].android folder to your desired location then create a symbolic link to it in C:\Users[USER].android with the same name.
If you wonder how to do this, first install Link Shell Extension. After folder movement right click on it and select Pick Link Source then right click in .android folder and in Drop As... sub menu select Symbolic Link.

I followed https://www.mysysadmintips.com/windows/clients/761-move-android-studio-avd-folder-to-a-new-location.
Start copying a folder "C:\Users\user\.android\avd" to "D:\Android\.android\avd" (or something else).
Close Android Studio and running emulators.
Press Win + Break and open Advanced System Settings. Then press Environment Variables. Add a user variable ANDROID_SDK_HOME. (I didn't experiment with ANDROID_AVD_HOME.) In Variable value field write D:\Android. If you also moved SDK to another folder, change ANDROID_HOME (I forgot to change it and some emulators didn't launch, see https://stackoverflow.com/a/57408085/2914140).
Wait until the folder will finish copying and start Android Studio.
Open Android Virtual Device Manager and see a list of emulators. If you don't see emulators and they existed, then probably you entered wrong path into user variable value in step 3. In this case close AS, change the variable and open AS again.
Start any emulator. It will try to restore it's state, but it sometimes fails. A black screen can appear instead of Android wallpaper.
In this case you can:
a. Restart your emulator. To do this close running emulator, then in AVD Manager click Cold Boot Now.
b. If this didn't help, open emulator settings, found in file "D:\Android\.android\avd\Pixel_API_27.ini".
Change a path to a new AVD folder. Restart the emulator.
Delete old AVD folder from "C:\Users\user\.android\avd".

For Windows 10 :
ANDROID_SDK_HOME
this link helped me.
Then just moved all content of "avd" to the new location. Now you may need to change the value of "path=" in the configuration Setting file of each avds to the new location. You can see the old avds in avd manager in Android Studio and they work.

ANDROID_SDK_HOME also worked for me on Windows 8 x64
also find all location (in my case it was d:\.android) and delete it. You won't need it anymore.

In AVD manager, after setting up AVD using a target with Google APIs, on run was getting error.
Detail showed: "AVD Unknown target 'Google Inc.:Google APIs:...... "
During install (on Win7 system) I had chosen a SDK directory location, instead of accepting C:\Users\...
I'd then added that directory to environment variable 'path'
Command line: android list targets did show a couple of Google apis.
Setting ANDROID_SDK_HOME to my install path fixed the avd run error.

Variable name: ANDROID_SDK_HOME
Variable value: C:\Users>User Name
worked for me.

MacOs
Get a directory adv
./emulator -help-datadir
the default directory is:
/Users/{your_computer_user_name}/.android
and then Go to avd Folder edit .ini file with path to your custom emulator directory
example :
path=/Volumes/Macintos/_emulatorandroid/avd/Nexus_5X_API_27.avd
path.rel=avd/Nexus_5X_API_27.avd
target=android-27
and then save. Now your Emulator haschange
And Result:

Related

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.

shorten directory path in terminal of visual studio code

i was watching a tutorial. In tutorial, instructor just executed command PROMPT $$ in terminal of visual studio code and his operating system was Windows.
changed his directory path to $$. Its not working on my machine.
i have tried https://www.hanselman.com/blog/ABetterPROMPTForCMDEXEOrCoolPromptEnvironmentVariablesAndANiceTransparentMultiprompt.aspx but its not working.
Finally found answer but it is a little bit different because the path 'C:\Windows>' didn't changed to '$$>' but it changed to 'C>' for all directories in drive C, and 'D>' for all directories in drive D.
Solution:
1. Go to Control Panel > System and Security > System
2. In left tab click Advanced system settings.
3. Dialog will appear. Click Environment Variables.
4. Under 'User variables for "Your username"' section, click 'New' Button.
5. Use following in the fields.
Variable name: PROMPT
Variable value: $n$g$s
Click OK
if does't work restart your machine. working for me.

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.

Apache Maven installation in windows 8

I followed steps mentioned in this link http://maven.apache.org/download.cgi
Whenever I type mvn --version in cmd.
I got 'mvn' is not recognized as an internal or external command, operable program or batch file.
But when I opened cmd with "Run as a administrator" it worked.
OS: windows 8
How can I run mvn for any user on windows 8.
Try setting the environment variable M2 as System variable instead of User variable.
I used Rapid Environment Editor, started as an Administrator, and put these variables into my System path, and this problem went away.
For some reason, when I added the the JDK, JRE, and Maven bin folders to my Path through the Windows utility, it didn't work. Rapid Environment Editor told me that the variables were not valid or I did not have access to them. Windows 8 seems to be really picky about administrator rights and I guess they didn't think that through very well.
Just be sure to start Rapid Environment Editor as an administrator, and re-open your command windows when you save your changes.
I had to move the installation directory of Maven into C:\Users*your_username*, so that Maven no longer required admin permissions. The PATH variables started working after that.
Set the MAVEN/M2 and MAVEN_HOME/M2_HOME variables in the environment variables in windows 8, this will solve the problem.
I'm using chinese version so that i'm not sure what's these word in english version.
click right button on "My computer"
click last item on list
click "Advanced system setting" at left side
"Evironment Variable"
append maven's bin directory into system's environment variables path
after all, try linux
The simplest way is:
Add maven directory to the path in systems variable.
don't add anything in user variable and no need to add any variable.
faced the same problem; The bins or files from path for M2_home and Java_home need to be found in a directory where the user has full control permission. Change the security permission settings of the user through the administrator by right click on the order, go to properties->security tab and check the Full control box for "authenticated user" and "user".

Moving default AVD configuration folder (.android)

After installation of Android SDK, the folder .android was created on the E:\ drive. As far as I know, this is the default folder of Android Virtual Devices for configuration files.
How can I move .android folder to a different location?
(eg. from E:\.android to E:\Android\.android)
I've found the answer.
Move .android folder to E:\Android
Create environment variable called
ANDROID_SDK_HOME and set its value to
E:\Android
Setting the environment variable on Windows XP or Windows 7:
Right-click on My Computer and choose "Properties"
Click the "Advanced" tab
Click the button "Environment Variables".
Add New variable
By default, the emulator stores configuration files under $HOME/.android/ and AVD data under $HOME/.android/avd/. You can override the defaults by setting the following environment variables.
The emulator searches the avd directory in the order of the values in $ANDROID_AVD_HOME, $ANDROID_SDK_HOME/.android/avd/, and $HOME/.android/avd/.
This page provides the list of environmental variables supported by android studio: https://developer.android.com/studio/command-line/variables
The path set in ANDROID_SDK_HOME must exist. Otherwise the default path will be chosen.
But it is not necessary to include .android. The AVD Manager creates a .android folder, if not found in ANDROID_SDK_HOME.
If you go for this answer be aware of this note:
Starting with Android Studio 4.2, the ANDROID_SDK_HOME environment variable is deprecated and has been replaced with ANDROID_PREFS_ROOT.
In addition to the answer provided by Dariusz Bacinski, you have to include the .android folder in the ANDROID_SDK_HOME path. It was not working for me if I did not include the .android folder.
If you want to move just the AVD folder and not everything else, use those environmental variables.
ANDROID_EMULATOR_HOME: Sets the path to the user-specific emulator configuration directory. The default location is
$ANDROID_SDK_HOME/.android/.
ANDROID_AVD_HOME: Sets the path to the directory that contains all AVD-specific files, which mostly consist of very large disk images. The default location is $ANDROID_EMULATOR_HOME/avd/. You might want to specify a new location if the default location is low on disk space.
If you would like your avd sdcard and files on a different drive, go to $HOME/.android/avd and move the folder <AVD_NAME>.avd to someplace else
Edit $HOME/.android/avd/<AVD_NAME>.ini and change
path=<NEW_AVD_LOCATION>/<AVD_NAME>.avd
$HOME depends on your system. On windows it can be your user directory
(Optional) Download Rapid Environment Editor
Add a new system variable
ANDROID_PREFS_ROOT = D:\IDE\Externals\ANDROID_PREFS_ROOT (The folder you want to move to.)
Save and you're done.

Resources