-1

I must create a Docker container for Ubuntu 12.04. I am setting up the container into a Windows 10 VM. To get build tools, I need to get apt-get install to work, but it can't reach its sources.

I am unable to get any networking on the 12.04. ping not installed, nor any networking tools (iputils). apt-get update which is what I really need, not working. I have tried a more recent Ubuntu version, and that works.

This works:

docker run -it --network bridge ubuntu:latest bash
root@3502f6313799:/# apt-get update
...
Fetched 20.4 MB in 47s (438 kB/s)
Reading package lists... Done

This doesn't work:

docker run -it --network bridge ubuntu:12.04 bash
root@32a12a2483a6:/# apt-get update
...
Err http://archive.ubuntu.com precise/main Sources
  404  Not Found [IP: 185.125.190.39 80]
...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/precise/main/source/Sources  404  Not Found [IP: 185.125.190.39 80]
...

I am just starting to use Docker, so far my searches found nothing that can help.

Please help me get any networking tools, any way to get the debians I need into the image, or give me ideas on troubleshooting.

4
  • Support for Ubuntu 12.04 ended many years ago. As such, that it doesn't support newer hardware, including virtualized devices, is entirely expected. And, of course, no unsupported OS should be used online even in a VM, you're endangering your whole network and likely beyond. Commented Apr 26, 2022 at 19:03
  • @ChanganAuto Ubuntu 12.04 can be installed in a VM, with any networking tools desired, and its access can be limited to apt-get if desired. You maybe missed the part where it is a Docker image.
    – Thalia
    Commented Apr 26, 2022 at 19:24
  • No, I didn't miss that part :) Commented Apr 26, 2022 at 19:28
  • Since I am building a toolchain for an embedded system that uses 12.04, I need to set up the 12.04 image in Docker. Whether through apt-get - which is not endangering the host or its network - or through other means if networking is not possible. I just need help to get me started since I am not used to have such a bare bone system.
    – Thalia
    Commented Apr 26, 2022 at 19:33

1 Answer 1

0

It seems that the Ubuntu 12.04 Precise repositories have moved. I had to modify the /etc/apt/sources.list to use ../old-releases/.. instead of ../archive/.. and all other prefixes.

And, since neither nano nor vi were available, I had to edit the file outside, and copy it into the container.

EDIT: You can do this in a Dockerfile as follows -

FROM ubuntu:12.04   
RUN sed -i s/archive/old-releases/g etc/apt/sources.list
RUN apt-get update && apt-get install ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .