简体   繁体   中英

E: Unable to locate package redis-server

I am using Ubuntu machine (14.04.1). I have installed docker daemon (1.12.3 and go version: 1.6.3). I have written a dockerfile which will download redis DB. But it is throwing me following error:

E: Unable to locate package redis-server

I tried redis also when redis-server did not work. It again throws the same error.

E: Unable to locate package redis

Contents of Dockerfile:

FROM ubuntu:14.04

RUN  apt-get update && apt-get install -y redis-server

EXPOSE 6379

I am able to run apt-get update but not able to install redis-server or redis. Docker's registry is docker hub. I am able to download redis in local ( sudo apt-get install -y redis-server ), outside docker but with docker I am not able to.

I am able to install redis-server as well as python. I added RUN apt-get update in Dockerfile. It updated and got redis installed. And there was one more thing in my case. I had already run 'apt-get update' which created an image before. All the time it was referring to the image and was not updating. Hence I used --no-cache=True and made it.

FROM ubuntu:14.04

RUN apt-get update

RUN apt-get -y install redis-server

It's not that easy like apt-get install: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-redis

By the way - You can use redis docker image, or look inside Dockerfile to check how they did it: https://hub.docker.com/_/redis/ https://github.com/docker-library/redis/blob/6cb8a8015f126e2a7251c5d011b86b657e9febd6/3.0/Dockerfile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM