利用docker制作一个带有redis软件的镜像,供其他人使用

Posted 张京墨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了利用docker制作一个带有redis软件的镜像,供其他人使用相关的知识,希望对你有一定的参考价值。

1. 宿主机在etc/apt/下创建一个haha的文件夹

技术图片

2.宿主机将haha文件夹映射到容器的虚拟系统中etc/apt/

技术图片

3. 此时,可以在宿主机和容器虚拟机中同步创建和删除文件

技术图片

技术图片

4. 将宿主机中的source.list文件同步到容器浏览器中。

4.1 更新前容器虚拟机中的更新源

技术图片

4.2 同步替换后的更新源

4.2.1 宿主机将sources.list拷贝到同步文件夹

技术图片

技术图片

4.2.2 容器虚拟机从同步文件夹中将sources.list拷贝到对应位置,覆盖掉原来的sources.list

技术图片

4.2.3 容器虚拟机更新源

apt-get update

报错:Is the package apt-transport-https installed?

安装:apt-get install apt-transport-https 依然报同样的错

报错:Unable to locate package apt-transport-https

原因:sources.list 问题,换成清华园的sources.list即可,直接更新。

技术图片
 1 # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
 2 deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted #Added by software-properties
 3 
 4 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
 5 # newer versions of the distribution.
 6 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
 7 deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse universe #Added by software-properties
 8 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
 9 
10 ## Major bug fix updates produced after the final release of the
11 ## distribution.
12 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
13 deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse restricted universe main #Added by software-properties
14 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
15 
16 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
17 ## team, and may not be under a free licence. Please satisfy yourself as to
18 ## your rights to use the software. Also, please note that software in
19 ## universe WILL NOT receive any review or updates from the Ubuntu security
20 ## team.
21 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
22 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe
23 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
24 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
25 
26 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
27 ## team, and may not be under a free licence. Please satisfy yourself as to 
28 ## your rights to use the software. Also, please note that software in 
29 ## multiverse WILL NOT receive any review or updates from the Ubuntu
30 ## security team.
31 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
32 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
33 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
34 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
35 
36 ## N.B. software from this repository may not have been tested as
37 ## extensively as that contained in the main release, although it includes
38 ## newer versions of some applications which may provide useful features.
39 ## Also, please note that software in backports WILL NOT receive any review
40 ## or updates from the Ubuntu security team.
41 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
42 deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
43 # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
44 
45 ## Uncomment the following two lines to add software from Canonical‘s
46 ## ‘partner‘ repository.
47 ## This software is not part of Ubuntu, but is offered by Canonical and the
48 ## respective vendors as a service to Ubuntu users.
49 # deb http://archive.canonical.com/ubuntu xenial partner
50 # deb-src http://archive.canonical.com/ubuntu xenial partner
51 
52 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
53 deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse restricted universe main #Added by software-properties
54 # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
55 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
56 # deb-src http://security.ubuntu.com/ubuntu xenial-security universe
57 deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse
58 # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
View Code

apt-get update 

 

以上是关于利用docker制作一个带有redis软件的镜像,供其他人使用的主要内容,如果未能解决你的问题,请参考以下文章

Windows10环境下制作SpringBoot项目的Docker镜像以及与宿主机上MySQLRedis进行桥接通信

Docker笔记三 Docker镜像制作

Docker笔记三 Docker镜像制作

CentOS中利用Docker安装Redis

centos7下安装docker(5镜像命令)

怎么在服务器上制作docker镜像