coding123
coding123

Reputation: 943

Docker - apt-get update not found

I am not able to build my Dockerfile without the following error:

/bin/sh: 1: apt-get update : not found

I am able to start a container using the docker run command, with no problems and can run apt-get update using docker run --rm -it ubuntu:16.04 bash

My Dockerfile:

FROM ubuntu:16.04

# Install Packages
RUN apt-get update

Building using:

docker build -t demo/app  .

Upvotes: 1

Views: 4467

Answers (1)

Adiii
Adiii

Reputation: 59896

You should pass apt-get update as an argument to bash in docker run command.

docker run --rm -it ubuntu:16.04 bash -c "apt-get update"

To work with this

FROM ubuntu:16.04

# Install Packages
RUN apt-get update

You need to build it first, then tag it and run it.

docker build -t demo/app  .

After build you do not need to update for now

docker run --rm -it demo/app bash

Upvotes: 1

Related Questions