Docker Community Forums

Share and learn in the Docker community.

A complete Ubuntu Image

Which Docker image is the best for Ubuntu 18.04. I mean the most complete. I wish to use a Docker container
for Ubuntu 18.04.

Every image that I pull seems to be missing something such as pip, conda, etc.

The descriptions of the images are quite limited, is their a moredetaied description located elsewhere? If so where?

I am talking about what is seen after typing “Docker images”. Any help appreciated.

Thanks in advance.

Respectively,

natalia1479.

A good docker os image includes a set of the bare minimum binaries and libraries that make up the os. Though, it is far away from beeing a full os. A container does not have its own kernel, does not “boot”, does not start systemd services…

Instead of looking for an image, create your own image base on the ubuntu:18.04. It’s not that complicated. Usualy only people with a lack of understand what docker is and does are trying to work directly in the terminal of a container from an os image…

Okay, but I usually find an image that meets my needs or close to it and I go with that. The image that I am using is one with pudb installed on it. It is gisjedi/pudb.

PUDB for python 2.7. That is perfect, however, I am having some issues. This I was told was hard to find. The support for python 2.7 pudb ended even before Python 2.7 ended last New Year’s eve.

I am just wanting to use this image: gisjedi/pudb. When I do pudb opens with welcome box (after I type pudb
*.py, but trying to get rid of that box is virtually impossible.

There seems to be no way to get rid of it. UI tried ctrl X and it worked once, once! Now nothing works.

Any help appreciated.

Respectfully,

natalia1479

I have no idea how this relates to the orginal question…
Can’t help you there.

My concept is to start with a minimum image and add what is needed as building an image is indeed not difficult. If you have an issue with an image, you need to contact the maintainer of that image. Do you have access to the Dockerfiles used to built that image? That is one way to start customizing the image for your usage. Sometimes you can get additional info using docker inspect to explore the image’s internal configuration.

I’d say:

a) Take the base ubuntu.
b) Complete a dockerfile with all what you need.

Here’s mine, tune with your own needs. I like to set comments to each thing I add so I know for which project is that:

FROM ubuntu:18.04

LABEL maintainer="Xavi Montero" description="This is a disposable devel server to run php 7.2. Rebuild it from xavi's repo bacteremia-hullabaloo." server="devel-sf4"

ENV TZ=Europe/Madrid
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# https://github.com/phusion/baseimage-docker/issues/58
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

# Customize amenities.
#    nano for editing files
#    readline-common for home+end keys
#    net-tools for netstat analysis tool
#    telnet for testing the server port manually
#    lynx for reading the server port from a browser
#    unzip for uncompressing files
#    iputils-ping for ping
RUN \
    apt-get update && \
    apt-get install -y nano readline-common net-tools telnet lynx unzip iputils-ping && \
    :

# Install base packages for running the symfony project.
#     php-curl for facebook/webdriver (which is in the standard --full symfony new installation)
#     php-zip for facebook/webdriver (which is in the standard --full symfony new installation)
#     php-intl for the Transliterator class that we can use to normalize things for search purposes. See: https://www.php.net/manual/en/class.transliterator.php
#     php-xdebug for generating code-coverage reports from phpunit
#     curl for installing the symfony binary
#     php-soap for hellotrip/dislodge-galvanize/servivuelo
#     php-imap for hellotrip/dislodge-galvanize/ddeboer/imap
#     php-sqlite3 for making in-memory tests with a real SQL engine
RUN \
    apt-get update && \
    apt-get install -y apache2 libapache2-mod-php7.2 && \
    apt-get install -y php php-json php-dom php-xml php-mbstring php-curl php-zip php-intl php-xdebug curl && \
    apt-get install -y php-soap php-imap php-sqlite3 && \
    apt-get install -y composer && \
    :

# Install typical packages for running projects.
#     php-mysql for connecting to mysql from the PHP applications
#     php-imagick + php-gd for salvador-escoda digital library (mapping PDF to images)
RUN \
    apt-get update && \
    apt-get install -y php-mysql php-imagick php-gd && \
    :

# Makes the imagemagick to be able to read and write PDF files.
#     This is needed for the salvador-escoda digital library, allowing the PHP to consume the php-imagick to read PDFs and write images.
RUN \
    cd /etc/ImageMagick-6 && \
    sed -i 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/g' policy.xml && \
    :

# Install Symfony webpack encore global requirements
#     nodejs for running the processors
#     npm as the standard package manager
#     yarn as the suggested package manager in symfony webpack-encore
RUN \
    apt-get update && \
    apt-get install -y nodejs npm && \
    npm install -g yarn && \
    npm install -g bower@1.8.8 && \
    npm install -g uglifycss@0.0.27 && \
    npm install -g uglify-js@3.1.3 && \
    :

# Remove the apt-get update cache.
# TODO: Do only the following if we really need to save space (a production server, for instance)
#RUN rm -rf /var/lib/apt/lists/*

# Setup the working user "ubuntu"
# TODO: This is host-dependant. We know we want to match user 1000 in the host for everything we do.
RUN \
    addgroup --gid 1000 ubuntu && \
    adduser --disabled-password --gecos "" --uid 1000 --ingroup ubuntu ubuntu && \
    :

# Make the ubuntu user to be able to sudo without password.
RUN \
    apt-get update && \
    apt-get install sudo && \
    echo "ubuntu  ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers && \
    :

# Setup color prompts for root and the user.
RUN \
    cd /root && \
    sed -i "s/#force_color_prompt=yes/force_color_prompt=yes/" .bashrc && \
    sed -i '53c\    PS1='"'"'${debian_chroot:+($debian_chroot)}\\u@\\[\\033[01;33m\\]\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '"'" .bashrc && \
    :

RUN \
    cd /home/ubuntu && \
    sed -i "s/#force_color_prompt=yes/force_color_prompt=yes/" .bashrc && \
    sed -i '60c\    PS1='"'"'${debian_chroot:+($debian_chroot)}\\u@\\[\\033[01;33m\\]\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '"'" .bashrc && \
    :

# Set the possibility to type-in UTF chars
# https://stackoverflow.com/questions/25637292/cannot-type-unicode-in-a-ubuntu14-04-container-can-type-just-fine-in-busybox
ENV LANG C.UTF-8

# Makes symfony checker to do not complain
RUN \
    sed -i "s/;date.timezone =/date.timezone = UTC/" /etc/php/7.2/apache2/php.ini && \
    sed -i "s/;date.timezone =/date.timezone = UTC/" /etc/php/7.2/cli/php.ini && \
    :

# Configure apache modules.
# TODO: This is host-dependant as there are volumes that will be mounted on /files when running the machine.
RUN \
    sed -i "s/APACHE_RUN_USER=www-data/APACHE_RUN_USER=ubuntu/" /etc/apache2/envvars && \
    sed -i "s/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=ubuntu/" /etc/apache2/envvars && \
    rm -Rf /var/www/html && \
    ln -s /files /var/www/html && \
    /bin/bash -c "sed -i '13 r'<( printf '\t<Directory /var/www/html>\n\t\tAllowOverride All\n\t\tOrder Allow,Deny\n\t\tAllow from All\n\t</Directory>\n\n' ) -- /etc/apache2/sites-available/000-default.conf" && \
    a2enmod rewrite && \
    :

#---------------------------------------------------------------------------#
# Speedup composer                                                          #
#---------------------------------------------------------------------------#

# Install the prestissimo as a global plugin for composer.
USER ubuntu

RUN \
    composer global require hirak/prestissimo && \
    :

USER root

# TODO: This part configures the docker for Xavi Montero. We should inject this info via environment.
RUN \
    curl -sS https://get.symfony.com/cli/installer | bash && \
    mv /root/.symfony/bin/symfony /usr/local/bin/symfony && \
    su -c 'git config --global user.email "xmontero@dsitelecom.com"' ubuntu && \
    su -c 'git config --global user.name "Xavi Montero"' ubuntu && \
    :

# Expose apache and ssl. Also make the bin/console server:run to be accessible from the outside.
EXPOSE 80 443 8000

# Start apache
CMD [ "apachectl", "-D", "FOREGROUND" ]
  1. Copy/paste this into a blank Dockerfile into an empty folder
  2. Do a composer build -t ubuntu-natalia1479 .
  3. Then run with docker run -d ubuntu-natalia1479 and you’ll have an apache server, but maybe you don’t want apache and want other things to run… Make this dockerfile yours and change it to remove what you don’t need and add what you need.

I did this as a “generic ubuntu” to develop multiple projects. You then have nano, ping, php, and all sort of things inside. Also the bash prompt for the unprivileged and the root user are tuned to my tastes. Tune it to your own needs.