Install vim in node Docker image - vim

I'm trying to install vim in my image. I'm using node as base image:
FROM node
RUN apt-get update & apt-get install vim
//more things...
I get this error:
E: Unable to locate package vim

You are only using a single ampersand (&) in your RUN directive, which runs a command in the background in bash. Change it to include two ampersands (&&). Please also notice the -y (automatic yes to prompts) I have added to the apt-get statement, without which your docker build command will fail:
RUN apt-get update && apt-get install -y vim

Related

Installation and usage of 'make htmldocs'

I want to convert Linux kernel rst files to html document.
Please provide clear steps to install the required packages and commands to generate rst file to html.
I have installed sphinx with below command
sudo apt-get install sphinxsearch
Facing an error when I run 'make htmldocs'
The Sphinx 'sphinx_rtd_theme' HTML theme was not found
If possible, could you please help me with right packages to install?
It looks like tricky and I have tried enough.
I just have figured it out that there is a document in the Linux kernel which explains the required information to use 'make pdfdocs':
Reference: Documentation/doc-guide/sphinx.rst
#sudo apt-get install sphinxsearch
#sudo apt-get install python-sphinx-rtd-theme
#sudo apt-get install texlive-latex-recommended
#sudo apt-get install texlive-base
#sudo apt-get install graphviz
#sudo apt-get install imagemagick
Run below commands from kernel root directory
#/usr/bin/virtualenv ~/sphinx_1.4
#. ~/sphinx_1.4/bin/activate
#pip install -r Documentation/sphinx/requirements.txt
#make htmldocs
Generated html documents are located at Documents/output

trying to do apt-get with docker, causing error 100

I have a node.js application that I'm dockerizing, and it has a system dependency magicgraph. I cannot seem to be able to install it, I've tried apt-get in the Dockerfile like so RUN apt-get install --force-yes -y graphicsmagick and a few variations, but I keep getting the error The command '/bin/sh -c apt-get install --force-yes -y graphicsmagick' returned a non-zero code: 100.
Not sure how to fix this, is there a step tutorial on how to install gz files with the http://www.graphicsmagick.org/INSTALL-unix.html url maybe?
You need update list of available packages before install new one.
replace RUN apt-get install --force-yes -y graphicsmagick
to
RUN apt-get update && apt-get install -y graphicsmagick
if it don`t fix the issue show logs please

Error installing Image Magick on Ubuntu 14.04

I have Ubuntu 14.04 on DigitalOcean, I tried to install ImageMagick
I have found and followed this instruction
I have updated my installation with this command
sudo apt-get update
Then I tried following
wget http://mirror.checkdomain.de/imagemagick/ImageMagick-6.9.2-10.tar.gz
tar -xvzf ImageMagick-6.9.2-10.tar.gz
cd ImageMagick-6.9.2-10
./configure
sudo make
sudo make install
But while it sudo make process, it returns error as you can see in the screen shot.
What I am doing wrong and how can I install it correctly?
First all it is a good practice to have things updated:
sudo apt-get update
Next, you should install imagemagick and php5-imagick from the repository:
sudo apt-get install imagemagick php5-imagick
And finally reload your web server.

How to run vi on docker container?

I have installed docker on my host virtual machine. And now want to create a file using vi.
But it's showing me an error:
bash: vi: command not found
login into container with the following command:
docker exec -it <container> bash
Then , run the following command .
apt-get update
apt-get install vim
The command to run depends on what base image you are using.
For Alpine, vi is installed as part of the base OS. Installing vim would be:
apk -U add vim
For Debian and Ubuntu:
apt-get update && apt-get install -y vim
For CentOS, vi is usually installed with the base OS. For vim:
yum install -y vim
This should only be done in early development. Once you get a working container, the changes to files should be made to your image or configs stored outside of your container. Update your Dockerfile and other files it uses to build a new image. This certainly shouldn't be done in production since changes inside the container are by design ephemeral and will be lost when the container is replaced.
USE THIS:
apt-get update && apt-get install -y vim
Explanation of the above command
apt-get update => Will update the current package
apt-get install => Will install the package
-y => Will by pass the permission, default permission will set to Yes.
vim => Name of the package you want to install.
Your container probably haven't installed it out of the box.
Run apt-get install vim in the terminal and you should be ready to go.
Add the following line in your Dockerfile then rebuild the docker image.
RUN apt-get update && apt-get install -y vim
Alternatively, keep your docker images small by not installing unnecessary editors. You can edit the files over ssh from the docker host to the container:
vim scp://remoteuser#container-ip//path/to/document
error:: bash: vi: command not found
run the below command by logging as root user to the container--
docker exec --user="root" -it (container ID) /bin/bash
apt-get update
apt-get install vim
Use below command in Debian based container:
apt-get install vim-tiny
Complete instruction for using in Dockerfile:
RUN apt-get update && apt-get install --no-install-recommends -y \
vim-tiny \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
It doesn't install unnecessary packages and removes unnecessary downloaded files, so your docker image size won't increase dramatically.
The most voted answer has the correct idea, however, it did not work in my case. The comment from #java25 did the trick in my case. I had to log into the docker container as a root user to install vim. I am just posting the comment as an answer so that it is easier for others, having the similar problem, to find it.
docker exec -ti --user root <container-id> /bin/bash
Once you are inside docker, run the following commands now to install vi.
apt-get update
apt-get install vim
To install within your Docker container you can run command
docker exec apt-get update && apt-get install -y vim
But this will be limited to the container in which vim is installed.
To make it available to all the containers, edit the Dockerfile and add
RUN apt-get update && apt-get install -y vim
or you can also extend the image in the new Dockerfile and add above command. Eg.
FROM < image name >
RUN apt-get update && apt-get install -y vim
Inside container (in docker, not in VM), by default these are not installed.
Even apt-get, wget will not work. My VM is running on Ubuntu 17.10. For me yum package manager worked.
Yum is not part of Debian or ubuntu. It is part of red-hat. But, it works in Ubuntu and it is installed by default like apt-get
To install vim, use this command
yum install -y vim-enhanced
To uninstall vim :
yum uninstall -y vim-enhanced
Similarly,
yum install -y wget
yum install -y sudo
-y is for assuming yes if prompted for any question asked after doing yum install package-name
error:: bash: vim: command not found
Run the below command by logging as root user to the container:
microdnf install -y vim
If you actually want a small editor for simple housekeeping in a docker, use this in your Dockerfile:
RUN apt-get install -y busybox && ln -s /bin/busybox /bin/vi
I used it on an Ubuntu 18 based docker.
(Of course you might need an RUN apt-get update before it but if you are making your own Docker file you probably already have that.)
Usually changing a file in a docker container is not a good idea. Everyone will forget about the change after a while. A good way is to make another docker image from the original one.
Say in a docker image, you need to change a file named myFile.xml under /path/to/docker/image/. So, you need to do.
Copy myFile.xml in your local filesystem and make necessary changes.
Create a file named 'Dockerfile' with the following content-
FROM docker-repo:tag
ADD myFile.xml /path/to/docker/image/
Then build your own docker image with docker build -t docker-repo:v-x.x.x .
Then use your newly build docker image.

How to answer an apt-get configuration change prompt on Travis-CI, in this case for couchdb 1.5.0

I am trying run a specific version of couchdb on travis-ci I do this by following the offical apt-get instructions from couchdb
Part of the installation is a prompt for what to do with an old configuration file. See the following:
Installing new version of config file /etc/logrotate.d/couchdb ...
Configuration file `/etc/couchdb/local.ini'
==> Deleted (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** local.ini (Y/I/N/O/D/Z) [default=N] ?
This causes travis-ci to hang and the build to fail.
Here is the travis-ci i have tried with and without the sudo rm and a handful of otherthings.
language: python
php:
- 2.7
install: "pip install -r requirements.txt"
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sudo apt-get install python-software-properties -y
- sudo add-apt-repository ppa:couchdb/stable -y
- sudo apt-get update -yq
- sudo apt-get remove couchdb couchdb-bin couchdb-common -yf
- sudo rm /etc/couchdb/local.ini
- sudo apt-get install -Vy couchdb
- sudo service couchdb start
before_script:
- curl -X PUT localhost:5984/njb_tests
script: python run-tests.py
You can see the different things i have tried by looking at my commit history:
https://github.com/Victory/notice-javascript-bugs/commits/master/.travis.yml
Hello my Frind its quite easy
I believe this command will do the trick
The 100% Working way no excuse no mercy!!
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install couchdb
The Softer way probally working
export DEBIAN_FRONTEND=noninteractive
apt-get -o Dpkg::Options::="--force-confnew" install -y
The Right way
on shell or in code do
export DEBIAN_FRONTEND=noninteractive
then
sudo apt-get -q -y install couchdb
It will assume “yes” to everything (and do it quietly)
you need to watch Debconf is the name of the tool. That page should help you get going with everything you want to know. debconf man page
The expect script method
you get asked for package maintainer or a password you should set on apt-get do here a simple example from a server that asks to set password on apt-get install
To keep your existing password, leave this blank.
Password for SYSDBA:
then you run it with this script below to do the input
#!/usr/bin/expect
spawn dpkg-reconfigure firebird2.5-superclassic -freadline
expect "Enable Firebird server?"
send "Y\r"
expect "Password for SYSDBA:"
send "newpwd\r"
# done
expect eof
Working example for your case is
- /usr/bin/expect 'spawn sudo apt-get install -Vy couchdb \n expect "*** local.ini (Y/I/N/O/D/Z) [default=N] ?" \n send "Y\r"

Resources