I have a docker run command that runs a chocolatey command. I am trying to use a variable in the choco command but getting an error. Hard coding the value of the variable in the command works.
This fails:
ARG azurecli_version="2.43.0"
RUN powershell choco feature enable -n allowGlobalConfirmation; choco install azure-cli --version ${azurecli_version} --no-progress
Error:
'--no-progress' is not a valid version string.
This works:
RUN powershell choco feature enable -n allowGlobalConfirmation; choco install azure-cli --version 2.43.0 --no-progress
Related
I'm upgrading a Dockerfile from Ubuntu 18.04 to 22.04. I'm using jruby for some test scripts, but unfortunately jruby is not in the apt repositories of 22.04 any more. Since I also can't find a PPA which I can use to install it I could simply download the binaries, but then I need to define a version. I just want to always get the most recent stable version, so I opted to use rvm to install it using the following lines:
RUN apt update -y
RUN apt install -y gnupg2
RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN \curl -sSL https://get.rvm.io | bash -s stable --ruby=jruby
RUN ["/bin/bash", "-c", "source /usr/local/rvm/scripts/rvm"]
RUN which jruby
When I run these lines manually in the container it works great, but in the container it errors out on the last line saying:
The command '/bin/sh -c which jruby' returned a non-zero code: 1
I also tried to run the last command using bash instead of sh using the line below, but that ends in the same error:
RUN ["/bin/bash", "-c", "which jruby"]
The path to jruby which I get when I run the commands inside the container is this:
/usr/local/rvm/rubies/jruby-9.2.9.0/bin/jruby
So without knowing the installed version of jruby, I can't know the path.
How can I install jruby in a simple way, defining the version of it?
I can create my virtual environment dev1 successfully, but I can not activate it and switch into in during the Docker building.
All I want is to switch the venv and install my dependencies in requirements.txt.
My code:
WORKDIR /APP
ADD . /APP
ARG CONDA_VENV=dev1
RUN conda create -y --name ${CONDA_VENV} python=3.7
RUN conda activate ${CONDA_VENV}
RUN pip install -r requirements.txt
Error:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
The command '/bin/sh -c conda activate ${CONDA_VENV}' returned a non-zero code: 1
I am trying to install Chrome on my windows container. I've created my docker image with a dockerfile and I would like to install chrome using this dockerfile. I've tried with the following command
RUN apt-get update -qqy \
&& apt-get -qqy install \
xvfb \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
but I have an error (I think it's because I am on windows container and this command is only for unbutu container...) :
'apt-get' is not recognized as an internal or external command,
operable program or batch file.
is there any way to install chrome in a windows container? Or any command to replace 'apt-get' ?
Thanks.
Here's a dockerfile I use to install headless chrome into an aspnet 4.5 image. Enjoy.
# extending the `microsoft/aspnet` image.
FROM microsoft/aspnet
RUN echo 'pull down choco'
RUN powershell -Command Install-PackageProvider -name chocolatey -Force
RUN powershell -Command Set-PackageSource -Name chocolatey -Trusted
RUN powershell -Command Get-PackageSource
RUN echo 'install chrome via choco'
RUN powershell -Command Install-Package GoogleChrome -MinimumVersion 74
Another possible route. Copy all your installers into an 'installer directory' next to your dockerfile. Then copy them in and run them manually.
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
RUN mkdir installers
COPY ./installers/ /installers
RUN ["c:/installers/ChromeStandaloneSetup64.exe", "/silent", "/install"]
RUN ["c:/installers/Firefox Setup 66.0.3.exe", "-ms"]
Hope this helps...
Hope this helps
I've installed tarantool (tarantool_box) and tarantool-client. I can start tarantool
/usr/bin/tarantool_box --background
but when I try to connect to server
/usr/bin/tarantool
I see only admin console
localhost>
and can only use some commands and sql-like queries. I can not use any of commands from user guide, and almost all commands which start with lua fail:
lua console = require('console')
---
error: 'Lua error: [string "local console = require(''console'')"]:1: attempt to call global ''require'' (a nil value)'
...
Solution, for clean Debian wheezy, found on tarantool github https://github.com/tarantool/tarantool
sudo apt-get update
sudo apt-get upgrade
after update
sudo apt-get install git
sudo apt-get install build-essential
sudo apt-get install libreadline-dev
sudo apt-get install cmake
sudo git clone https://github.com/tarantool/tarantool
cd ./tarantool
sudo git submodule update --init --recursive
sudo cmake .
sudo make
after build
sudo ./tarantool/src/tarantool
Usually I use this command for docker version of tarantool/tarantool:
tarantoolctl connect 3301
But you can also use docker directly
docker exec -it tarantool_1 console
I've got a Dockerfile for some lua and torch related tasks and I'm trying to install some rocks using luarocks.
FROM ubuntu:14.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get update -y
RUN apt-get install -y curl git
RUN curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
RUN git clone https://github.com/torch/distro.git ~/torch --recursive
RUN cd ~/torch; ./install.sh
RUN source ~/.bashrc
RUN luarocks install nngraph
RUN luarocks install optim
RUN luarocks install nn
RUN luarocks install cltorch
RUN luarocks install clnn
docker build runs fine up until the first luarocks call: RUN luarocks install nngraph at which point it stops and throws the error:
/bin/sh: luarocks: command not found
If I comment out the luarocks lines, the build runs fine. Using that image, I can create a container and using bash, run luarocks as expected.
Of course, I don't particularly want to have to do this every time I start up the container, so I'm wondering if there's anything I can do to make this work. I have a feeling that this problem has something to do with the line RUN rm /bin/sh && ln -s /bin/bash /bin/sh but I need that to be able to run the line RUN source ~/.bashrc.
Thanks.
Each RUN command runs on its own shell and a new layer is committed.
From the Docker documentations:
RUN (the command is run in a shell - /bin/sh -c - shell
form)
So when you run luarocks install <app> it will not be the same shell you source your profile.
You have to provide the full path for luarocks to run. See below a modified Dockerfile I successfully run:
FROM ubuntu:14.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get update -y
RUN apt-get install -y curl git
RUN curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
RUN git clone https://github.com/torch/distro.git ~/torch --recursive
RUN cd ~/torch; ./install.sh
RUN source ~/.bashrc
RUN /root/torch/install/bin/luarocks install nngraph
RUN /root/torch/install/bin/luarocks install optim
RUN /root/torch/install/bin/luarocks install nn
RUN /root/torch/install/bin/luarocks install cltorch
RUN /root/torch/install/bin/luarocks install clnn
For more details see docker RUN documentation here.
As Alex da Silva pointed it out, sourcing .bashrc happens in another shell in your Dockerfile.
You could also try that to have your luarocks commands executed in the same shell with your sourced bashrc:
...
RUN source ~/.bashrc && luarocks install nngraph
RUN source ~/.bashrc && luarocks install optim
RUN source ~/.bashrc && luarocks install nn
RUN source ~/.bashrc && luarocks install cltorch
RUN source ~/.bashrc && luarocks install clnn