Devilbox: How to install additional software in the containers

Created on 29 Nov 2017  路  8Comments  路  Source: cytopia/devilbox

I want to install some additional software like nano or something else.

I tried this in docker-compose.yml

  # ------------------------------------------------------------
  # PHP / HHVM
  # ------------------------------------------------------------
  php:
    image: cytopia/${PHP_SERVER:-php-fpm-7.0}:latest

    command: bash -c "apt-get update && apt-get -y install nano"

    restart: always

but it doesn't work

How can i do that?

UPDATE:

command: bash -c "yum install nano"

doesn't work, too

Most helpful comment

What about:

#!/bin/sh
docker-compose up -d
sleep 10
docker-compose exec httpd /bin/bash -c "apt-get update && apt-get -y install nano"
docker-compose exec php /bin/bash -c "sudo yum -y install nano"

All 8 comments

This currently won't work. All PHP images are CentOS-based and the HHVM image is Debian-based.

You will have to enter the container via ./shell.sh and then use something like sudo yum install nano.

Alternatively, if you require basic software that you would like to see in those images by default, just paste the software you require here: https://github.com/cytopia/devilbox/issues/154

docker-compose exec httpd /bin/bash -c "apt-get update && apt-get -y install nano"
docker-compose exec php /bin/bash -c "sudo yum -y install nano"

works with shell.sh

is it possible to execute shell.sh automatically when calling docker-compose up -d ?

What about:

#!/bin/sh
docker-compose up -d
sleep 10
docker-compose exec httpd /bin/bash -c "apt-get update && apt-get -y install nano"
docker-compose exec php /bin/bash -c "sudo yum -y install nano"

Yes right, this way it works. but start and stop is taking more time now. :(

Would it be possible, that you install nano as default in the containers like the other stuff?

Sure, added here: #154

Sorry, is there a better way to approach this? Adding 10 seconds to startup just for the sake of adding new packages to the container seems a bit hacky. :thinking:

Sorry, is there a better way to approach this? Adding 10 seconds to startup just for the sake of adding new packages to the container seems a bit hacky.

This is only for the first startup. State is kept if you shut it down and do not remove it.

In your Dockerfile, add this line at the end of file. This will build the container with nano and vim
For Ubuntu:
RUN apt-get update && apt-get -y install nano vim && apt-get autoremove
For CentOS:
RUN yum update && yum -y install nano vim && yum clean all

Was this page helpful?
0 / 5 - 0 ratings

Related issues

msyhr picture msyhr  路  7Comments

fkaminski picture fkaminski  路  4Comments

drupalshift picture drupalshift  路  5Comments

sustained picture sustained  路  6Comments

zack6849 picture zack6849  路  5Comments