In circle CI build I am trying to install nvm as follows:
- run:
name: Install nvm
command: curl -o-https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
But I am getting this error:
How do fix this issue?
Disclaimer: Developer Advocate at CircleCI
You didn't specify which Docker image (or executor) you are using. Most likely you're using a Docker image that doesn't include Bash. You can do one of three things:
Install Bash first in that Docker image.
Choose a Docker image with Bash already installed.
Use sh for the command instead of Bash.
Option 3 is the easiest option as long as the install script isn't using Bash specific features. You can try it by replacing the end of the command like this:
curl -o-https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | sh
Related
I just start learning laravel, and follow the tutorial from https://laravel.com/docs/8.x/installation "Getting started on Windows" .
I manage to install Docker Desktop and COnfigured to use WSL2 Backend.
When I run the command curl -s https://laravel.build/example-app | bash to create laravel application directory from cmd, this warning come out Docker is not running.
I run curl using command prompt. (cmd).
Update:
So, I run the command in Windows Terminal:.
PS E:\Play> curl -s https://laravel.build/example-app | bash
Here is the response I get:
cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri:
Any Idea what to do?
Try to explicitly enable integration with your distro in Docker settings:
After that relaunch your WSL2 terminal & try again. That should help.
You can also open https://laravel.build/example-app in a browser & check what commands the script is running: and run them manually to check the output for any errors.
For those who are using Ubuntu or Debian can check this guide out on how to install and configure Docker.
sudo snap install docker
sudo usermod -aG docker $(whoami)
sudo chmod 666 /var/run/docker.sock
You need to install a linux distro, and then in Windows Terminal create a new tab for the linux distro and run the command there, not in a windows powershell tab.
Make sure that you are running curl command on your distro. Use Windows Terminal app and open a new tab as WSL2 (your distro).
sudo chmod 666 /var/run/docker.sock
I guess you are using ubuntu or debian.
chmod will do the trick here.
I'm trying to write a script that creates a Docker image from a Jenkins image, that is, the first line of my Dockerfile is...
FROM jenkins/jenkins:2.249.3
However I wanna be smart and write a script that gets the latest Jenkins stable version and sed that into my Dockerfile, like this
Dockerfile:
FROM jenkins/jenkins:JENKINS_LATEST_STABLE_VER
$ export JENKINS_LATEST_STABLE_VER=`some_api_call`
$ sed -i "s/JENKINS_LATEST_STABLE_VER/$JENKINS_LATEST_STABLE_VER/g" Dockerfile
$ docker build ...
What is "some_api_call"?
latest stable:
curl -L --max-redirs 2 https://updates.jenkins.io/stable/latestCore.txt
latest current:
curl -L --max-redirs 2 https://updates.jenkins.io/current/latestCore.txt
Building off of Ian's comment
https://updates.jenkins.io/current/latestCore.txt
https://updates.jenkins.io/stable/latestCore.txt
is one way to get the latest version, but read through the document in that comment.
I also found this answer which agrees
Jenkins - get latest artifact with curl
Ok, I installed kubectl in the following way on my Mac:
1) installed gcloud using homebrew
2) installed kubectl using gcloud components install.
I want to run a shell script that calls kubectl directly. However, I get an error.
$ kubectl version
-bash: kubectl: command not found
I expected gcloud components install to set path variables so that I can call kubectl. Looks like that has not happened. I searched for kubectl in my mac but was not able to find it.
How can I get kubectl to work from command line?
Short answer:
On macOS, you may need to add a symlink: sudo ln /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/kubectl /usr/local/bin/kubectl
Long answer:
I believe this is caused by installing kubectl via homebrew, then via gcloud, and then uninstalling the homebrew managed tool. homebrew will remove its symlink but gcloud doesn't add it back even when you reinstall kubectl.
To see if this is affecting you on macOS:
See if gcloud has installed kubectl: gcloud info | grep -i kubectl
If you are having the problem I am, I'd expect to see the output look something like this:
kubectl: [2019.05.31]
Kubectl on PATH: [False]
When working you should see something like this:
kubectl: [2019.05.31]
Kubectl on PATH: [/usr/local/bin/kubectl]
/usr/local/bin/kubectl
Check for the symlink: ls -la /usr/local/bin | grep -i google-cloud-sdk. That will show your links to google cloud binaries.
If kubectl isn't on the list then run sudo ln /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/kubectl /usr/local/bin/kubectl
The gcloud info command will tell you if and where kubectl is installed.
Per https://kubernetes.io/docs/tasks/tools/install-kubectl/, you can install kubectl with brew install kubernetes-cli. Alternatively, you can install the Google Cloud SDK per https://cloud.google.com/sdk/docs/quickstart-macos, and then install kubectl with gcloud components install kubectl.
Just to update and add more clarity around this:
If you did not install kubectl via Homebrew but chose to do
gcloud components install kubectl
instead then the binary is installed inside the bin folder of your gcloud install folder. Even if your gcloud bin folder is already on your shell's PATH it wont see kubectl right away unless you start a new shell or run hash -r (bash / zsh) to tell your shell to discard its cached paths.
Thanks to #mark, I was able to sort this out, but I feel modifying the $PATH is a better approach. I also found that the Caskroom folder was in a different spot. So I recommend adding this to the relevant rc file:
export PATH="`brew --prefix`/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:$PATH"
When running a Docker command such as
docker run ubuntu /bin/echo 'Hello world'
used in the in the starter example docs on the Learn by Example page of the Docker docs I see the error
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: oci runtime error: exec: "C:/Program Files/Git/usr/bin/bash": stat C:/Program Files/Git/usr/bin/bash: no such file or directory.
How can I resolve this?
This error could be caused by the setup on your system including mingw (you might see this if you have installed Git for Windows with MSYS2 for example - see here for more information). The path is being converted - to stop this you can use a double slash // before the command. In this example you can use
docker run ubuntu //bin/echo 'Hello world'
(notice the double slash (//) above). If all goes well you should now see
Hello world
An complete and slightly more complex example is starting an Ubuntu interactive shell
docker run -it -v /$(pwd)/app:/root/app ubuntu //bin/bash
Note that in my case using Git Bash I only needed one extra slash because echo $(pwd) on my machine expands to:
/c/Users/UserName/path/to/volume/mount
As another example the following can be used if zip is not available (as is the case on Windows 10 as well as Git Bash) You cannot easily zip a file for a something like an AWS Lambda function (actually there are few ways without Docker or even installing third party software if you prefer). If you want to zip the app folder under your current directory use this:
docker run -it -v /$(pwd)/app:/root/app mydockeraccount/dockerimagewithzip //usr/bin/zip -r //root/app/test1.zip //root/app
The mydockeraccount/dockerimageqithzip can be build by creating a Dockerfile like this:
FROM ubuntu
RUN apt-get update && apt-get install -y zip
Then run:
docker build -t mydockeraccount/dockerimagewithzip .
My docker image is tianon/gentoo-stage3:latest
And my host system is centos7 and my docker version is Docker version 1.6.0, build 4749651
When I run this image , I found I can not use rc-update command. ls -l /sbin/rc* show empty result.
I have no idea what package I need to install.
rc-update is provided by the sys-apps/openrc package. Why you don't have it is a mystery without knowing more about the image / setup. The image may be using systemd, but that doesn't necessarily rule out the openrc package being installed.
You should run: ps -p 1 -o command. That will give you an indication of your init system. If it says systemd, whatever you are trying to do with rc-update should probably be done with the systemctl command instead.
If you are indeed using sysvinit / openrc, I suggest you update your openrc package by emerge -a openrc That will restore the rc-update command.