Install a specific node version with ddev and keep in container - ddev

What is the recommended way to do the follwing:
install a specific version of node in a ddev container
so it persists (after ddev stop/start)
and every user that downloads and builds the container gets the right node version?
The idea behind it is to "nail" the node version for compatibility (in our case, with older versions of Foundation for Sites framework)

Edit 2022-08-10: In DDEV v1.19+ nvm is already pre-installed, and can be easily used inside the container or with ddev nvm.
Original anwer: What you really want is nvm for this requirement, so this is a duplicate of https://stackoverflow.com/a/61934500/215713, which shows how to install nvm with a specific default node version.

Related

macOS: How to update Docker Desktop that's running on an external drive, without removing existing containers?

I have installed Docker Desktop 3.0 on my mac - on an external drive.
I'm trying to uprade it to latest. I don't get prompted for them and I can't see any option to check for updates in the GUI.
I'd rather not uninstall incase it removes the containers and the data I have set up. But maybe I won't lose them?
can someone point me in the right direction?
thanks.
The location of the files dosn't play role in the upgrade. What plays the major role role is the source version and target version. There are two ways to upgrade the Docker for Mac, and there will be described in detail below:
Incremental upgrade
Upgrade with rebuild (Export / Import)
In the specific case of the upgrade from 3.03 to 3.3, the upgrade to 3.1 and 3.2 can be done as incremental, without need to export / import data, however the upgrade to 3.2.1 will require rebuild of the VM, so the export / import method will help to move the data to the new VM.
Location of data
The application dosn't contain the data for the containers. Docker for macOS is running on a virtual machine, and the data is stored on the virtual disk of the virtual machine.
The raw data (the virtual disk) of the virtual machine is located in
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
Where the 0 is for the 0th VM. By default it's only one VM, but it's better to check. You can find this information from the GUI from Preferences > Resources > Disk Image Location. Simple copy of the content of the data folder will preserve the virtual machine.
Incremental Upgrade
It's always recommended to do incremental upgrade by following the official release versions between your current version and the target version. The releass can be found in the release notes.
The steps to upgrade are:
Stop the docker application (from the menu, find the docker icon and select Quit Docker Desktop
Make full backup of the ~/Library/Containers/com.docker.docker/Data
Rename the application (you might need it to go back, in case the upgrade is not successful)
Copy the new application in the destination and start it.
This steps will be repeated for each minor version between the source version and target version. Some versions can be skipped, however it's not recommended.
In case of problems you can use the troubleshooting guid.
Upgrades with rebuild of the VM
Be aware that upgrading the docker from certain older version to new version might require a rebuild of the virtual machine.
In addition, sometimes the upgrade is not working properly and you will need to uninstall the application as described in the troubleshooting page.
So before you proceed with the uninstall and rebuild of the VM, if you have data that it's important for you, it is highly recommendable to export the containers, volumes and images before the upgrade.
You will need to make a list of all of the containers, images and volumes you want to move across to the new VM. Following docker commands will help:
~# docker ps -a
~# docker volume ls
~# docker image ls
To export the information, you can use the docker export and docker image save. The following example will save the image or the container/volume to file called file.raw:
~# docker export <<volume name or contianer name>> > file.raw
~# docker image save <<image name>> > file.raw
Once the Docker is installed (the latest version) and the VM is rebuild, to import the data back from the files, you will need to use:
~# docker import file.raw
~# docker image load file.raw

Elasticsearch 7.6.2 service not starting on CentOS 7.x with cPanel installed on it

I have installed elasticsearch version 7.2.6 on CentOS 7.x with cPanel on it. However, after installing it, elasticsearch service is not running. Here is the screen capture of the error. I have already tried. https://support.cpanel.net/hc/en-us/articles/360055446413-How-To-Install-Run-Elasticsearch but the issue is not resolved. Any help will be appreciated.
I have set my IP address in network.host
You probably have data from an older ES install. If you're installing a new version and want to keep your older data, you need to go through the upgrade path.
otherwise, if you don't care about your older data and simply want to install the newer version, simply delete the content of /var/lib/elasticsearch and install the new version.

bind source path does not exist: /host_mnt

I have a ddev installation on macOS which I used for a while.
ddev 1.16.2
docker 20.10.0
macOS 11.0.1 - Intel
Today I upgraded to docker 20.10.0 and in the process to ddev 1.16.2.
When I start an existing site, that worked all the time I get
Creating ddev-mysite-db ... error
ERROR: for ddev-mysite-db Cannot create container for service db: invalid mount config for type "bind": bind source path does not exist: /host_mnt/Users/me/Documents/Development/WebSite/mysite/.ddev
This started to happen after I upgraded docker from the previous version. Upgrading ddev did not change too much.
Even when I create a new site, the same error message pops up so I am pretty much stuck.
At least for me it looks like the docker 20.10.0 breaks ddev. Any ideas how to deal with that are very much appreciated.
Docker/macOS are not allowing access to the directory ~/Documents.
Starting with macOS Catalina, ~/Documents is a "protected directory", so you have to allow docker access to it, and docker should prompt.
However, Docker Desktop for Mac's 3.0.0 release (which I imagine you're referring to) had a bug where it did not do this properly. I imagine you need to upgrade to version 3.0.1 which was released today. Just "Check for updates"
In Docker > Preferences > Experimental features you can try disabling gRPC, and make Docker use osxfs file sharing system.
Reference: https://github.com/docker/for-mac/issues/4859#issuecomment-689012097

Do I need to install kubectl after installing docker?

Do I need to install kubectl after installing docker? Yet docker comes with its own version of kubeCtl?
I was watching this tutorial and I saw that kubectl was installed after installing docker. Even in the Kubernetes docs they say:
Note: Docker Desktop for Windows adds its own version of kubectl to
PATH. If you have installed Docker Desktop before, you may need to
place your PATH entry before the one added by the Docker Desktop
installer or remove the Docker Desktop's kubectl.
This, to me, seems to imply that it is not uncommon to install kubectl when you have installed one that comes with docker. Why is it so?
You may want to have different version of kubectl in certain scenarios. For example you may want to interact with a remote kuberneretes cluster from the same windows system with latest version of kubectl which may not be installed with docker desktop.
It's generally recommended to have a version of kubectl which matches with the Kubernetes API Server version.

how to uninstall sonarqube-6.4.1 from ubuntu

h all ,
i am trying to uninstall sonarqube from the ubuntu machine using command "sudo apt-get remove --purge autoremove sonarqube-6.4.1" but I am getting error as no packages foun some one kindly help me with uninstalling soanrqube complaetly from ubuntu machine
Your purge isn't working because SonarQube likely wasn't installed via apt-get. So how was it installed? The docs offer clues:
Installing the Web Server tells you to download the SonarQube zip, expand it, and configure the properties file. So your first step would be to wipe out the SonarQube directory.
Of course, if SonarQube is running as a service on your machine, just deleting the diretory could lead to errors at the next startup, so you'll need to unwind that part too. For setting up a service, the docs advise you to:
create /etc/init.d/sonar
create a link in /usr/bin/sonar to the SonarQube start script
update your defaults
So you'll want to back those things out too.

Resources