1、容器中部署nginx服务
centos:7镜像运行一个容器,并且,在这个容器内部署Nginx服务。
[root@Docker ~]# docker pull centos:7 //下载镜像
[root@Docker ~]# docker run -itd --name webapp --restart=always centos:7 //运行一个容器名为:webapp
[root@Docker ~]# docker cp nginx-1.16.0.tar.gz webapp:/root //将本地nginx包导入webapp容器内
[root@Docker ~]# docker exec -it webapp /bin/bash //进入容器
[root@85099880dabe ~]# tar zxf nginx-1.16.0.tar.gz
[root@85099880dabe ~]# cd nginx-1.16.0
[root@85099880dabe nginx-1.16.0]# yum install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel //下载相关依赖包
[root@85099880dabe nginx-1.16.0]# useradd -M -s /sbin/nologin nginx //添加一个没有登录权限的nginx用户
[root@85099880dabe nginx-1.16.0]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx //编译安装
[root@85099880dabe nginx-1.16.0]# make && make install //编译安装
[root@85099880dabe nginx-1.16.0]# ln -s /usr/local/nginx/sbin/* /usr/local/sbin/ //创建软链接
[root@85099880dabe nginx-1.16.0]# nginx
[root@85099880dabe nginx-1.16.0]# nginx //确认nginx服务开启
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
[root@85099880dabe nginx-1.16.0]# cd /usr/local/nginx/html/
[root@85099880dabe html]# echo "TEST WEB" > index.html
[root@85099880dabe html]# curl 127.0.0.1
TEST WEB
2、迁移镜像
所需环境:
docker1主机:192.168.45.129
docker2主机:192.168.45.134
1)docker1主机
将docker1的刚刚创建的容器并制作成镜像导入docker2主机上
[root@Docker ~]# docker commit webapp myweb //将webapp容器制作成镜像名为myweb
sha256:b035b8e8a36140e1bdbda9cf3a736b139ea8a48db7871a10f509b8f34d4c0f82
[root@Docker ~]# docker save > myweb.tar myweb:latest //将镜像导出
[root@Docker ~]# scp myweb.tar 192.168.45.134:/root //将镜像导出的tar包cp给docker2主机
The authenticity of host '192.168.45.134 (192.168.45.134)' can't be established.
ECDSA key fingerprint is d7:77:71:90:34:25:c0:ec:e0:b6:5c:cc:6b:44:93:7b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.45.134' (ECDSA) to the list of known hosts.
root@192.168.45.134's password: //密码为docker2主机的密码
myweb.tar 100% 353MB 176.4MB/s 00:02
2)docker2主机
[root@Docker2 ~]# docker load < myweb.tar //将刚刚cp过来的tar包制作成镜像
[root@Docker2 ~]# docker run -itd --name newweb myweb:latest //启动一个容器
[root@Docker2 ~]# docker exec -it newweb /bin/bash //进入容器
[root@4e419b580248 /]# nginx
[root@4e419b580248 /]# nginx //确定已启动nginx服务
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[root@4e419b580248 /]# curl 127.0.0.1
TEST WEB
注:这里我们可以看见在docker1主机容器中搭建的简单nginx环境并制作成镜像成功的迁移到了docker2主机上了
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
Docker容器,部署nginx
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新动态
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]