3

I'm trying to build a ubuntu-server container for a development environment, but I'm prompted to select a keyboard layout, and character set.


Running a container:

docker run --rm it ubuntu

In the container:

apt-get update && apt-get install -y ubuntu-server

(I'm then eventually prompted to select and keyboard, then charset.)

Container works - but it's interactive :( I want to repeat the process non-interactively with a Dockerfile.


A Dockerfile (which fails):

Dockerfile:

FROM ubuntu:16.04
RUN apt-get update && apt-get install -y ubuntu-server

Build it:

docker build -t ubuntu-server .

-- Failure

How to build/install ubuntu-server non-interactively in a container?

NonCreature0714
  • 155
  • 1
  • 2
  • 7

1 Answers1

5

Add to your Dockerfile before RUN command, this sets noninteractive mode for apt-get:

ENV DEBIAN_FRONTEND noninteractive
Gnat
  • 279
  • 1
  • 3
  • currently investigating the container functionality - it did build! thanks – NonCreature0714 Dec 24 '17 at 22:02
  • This is not good practice because the environment variable will persist to past the build process, resulting in unexpected issues later on, especially if users can get a shell in the container, or you use docker exec. See this answer: https://serverfault.com/a/980134/668858 – kuilin Jun 22 '22 at 17:24