How to manually migrate lxd container to another server via file copy - lxc

I have a server with several lxd containers on it.
Due to the incident, the hard disk of the server was damaged.
The files can still be accessed when opened as an external hard drive, but when used as a boot, the operating system runs abnormally.
So I need to replace it with a new hard drive.
The new hard drive has been setup with LXD.
So how do I move the container from the old hard drive to the new hard drive?

Related

Move docker desktop data folder (windows containers)

I'm using docker desktop (4.X) over win10 pro. We are building Windows applications and using Windows containers.
On our setup, the folder C:\ProgramData\Docker(images/windowsfilter/tmp & co) can grow up to hundreds of GB, and i need to move this folder to an alternative location.
Again, i am using WINDOWS CONTAINERS (i do not care about wsl2 or hyper-v specific solutions)
I tried moving / creating a junction between
C:\ProgramData\ Docker => D:\DockerData, but windows containers backend does not start.
If i switch back to linux containers, everything is working fine (and i know how to move WSL2 vhdx, if needed, but again, i DO NOT NEED THAT information).
Moving HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProgramData location BEFORE installing docker desktop, works, but it is not an acceptable solution
I tried configuring data-root directory in %USERPROFILE%.docker\windows-daemon.json, But it does not work, windows containers backend does not start.
Please give me a reliable way to move the C:\ProgramData\Docker folder to another location.
Unfortunately, when utilizing Windows Containers, it is not yet feasible to relocate the C:ProgramDataDocker folder to another location. This is so that container images and other data can be stored in this directory, which the Docker for Windows service is hard-coded to utilize.
You might try using a symbolic link to reroute the C:ProgramDataDocker folder to an other place as a solution. This may not be a reliable approach, though, as the Docker for Windows service might not handle the symbolic link correctly, which would prevent the service from starting.

How to store nextcloud docker files inside my hdd rather than in a image of docker

I am actually relatively new to docker and wanted to build a home server for files, I use windows 10, and Docker Desktop for deploying containers.
whenever I store my files on nextcloud I do not see them on my HDD. Rather they are in an image(as far as I know), so I wanted a solution to make all the files appear on my hard drive rather than an image because then I can also use my computer as a rendering server, to render videos and games.

How to configure a writable folder inside an application published to Azure App Service using Docker for Windows

I'm working in an application to obtain some data from a web service, create a text file in the local filesystem send a command to a command line application, obtain the result and then send the results back via the web service.
I need to be able to write to the local file system, read from it and then delete the temporary file. I was reading about bind mounts and volumes but this folder can be delete if a new version of the image is uploaded is just a staging area.
Any ideas how this can be done, thanks.
When using containers in App Service, I believe you will have to link a storage account and mount file shares accordingly. Depending on the OS (windows / linux), the steps vary a bit.
If you are not using containers, then you should be able to access the temporary file locations for file-based requirements. Do note that the storage available this way is limited and not shared across site instances.

Docker remote volume and remote machine performance

I am planning a setup where, the docker containers are using remote volume - volume that have ssh-ed to another machine and it is reading all the time.
Lets say we have 5 containers using that remote volume. In my understanding, the docker is ssh-ed to the remote machine and constantly reading on certain directory (with about 100 files, not more than few MB).
Presumably that constant reading will put some load to the remote machine. Will that load be significant or it can be negligible? There is php-fpm and Apache2 on the remote machine, will the constant reading slow down that web server? Also, how often the volume is refreshing the files?
Sincerely.
OK after some testing:
I have created a remote volume with vieux/sshfs driver.
Created an ubuntu container with the volume mounted under certain folder.
Then tail a txt file from the container itself.
Write to that txt file form the remote machine (the one that contains the physical folder).
I have found out, if we write to the file continuously (like echo "whatever" >> thefile.txt). The changes appear all at once after few seconds, not one by one as they have been introduced. Also, if I print or list the files in the mounted directory, the response is instant. This makes me thing, that Docker is making local copy of the folder ssh-ed in the volume and refreshes it every 5 sec or so. Basically negligible load after the folder is copied once.
Also, when trying to write from the container to the mounted folder, the changes on the file are reflected almost instantly (considering any latency). Which makes me think that the daemon is propagating the write changes instantly.
In conclusion - reading a remote folder, puts negligible load to the remote machine. The plan is to use such setup in production environment, so we don't have to pull changes on two different places (prod server and machine which is sharing (local) volume between containers).
If there is anyone who can confirm my findings, that would be great.
Sincerely

Is it possible to install NServiceBus nodes on an attached virtual disk drive in a VM?

The server in question, a Server 2008 R2 VM, has very little space left on the C: drive, but has an attached virtual disk drive with 30GB unused. With some research, I found that installing Windows services from an attached virtual drive is possible, but the registration keys will be lost if Windows is reinstalled.
Is it possible to install the NServiceBus services from the attached virtual disk drive? If so, are there any other concerns about NServiceBus operation that I should be aware?
An attached disk is just a disk that gets mounted like any other disk. What is important is that the mounting takes place before the service is started. So make sure that windows service is dependent on the correct services.
You can set dependencies by using the commandline tool sc.exe which is explained here:
https://serverfault.com/questions/24821/how-to-add-dependency-on-a-windows-service-after-the-service-is-installed
As you are using NServiceBus it could be that that service is dependent on MSMQ or MSDTC or maybe a local SQL Server instance. All of these can be added so that the windows service will be started after the other services are running.
If the 'attached disk' is configured by the VM host then you don't have to worry about mounting at all.

Resources