828华为云征文 | 云服务器Flexus X实例,Docker集成搭建FC-web模拟器
华为云端口放行
- 服务器放行对应端口9995
Docker安装并配置镜像加速
1、购买华为云 Flexus X 实例
Flexus云服务器X实例-华为云 (huaweicloud.com)
2、docker安装
yum install -y docker-ce
3、验证 Docker 是否安装成功,启动docker服务并设置开机自启动,且查看docker状态
docker --version systemctl enable docker systemctl start docker systemctl status docker
4、docker-ce下载
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo
5、路径/etc/yum.repos.d修改配置文件
[docker-ce-stable] name=Docker CE Stable - $basearch baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/$basearch/stable enabled=1 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg [docker-ce-stable-debuginfo] name=Docker CE Stable - Debuginfo $basearch baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/debug-$basearch/stable enabled=0 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg [docker-ce-stable-source] name=Docker CE Stable - Sources baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/source/stable enabled=0 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg [docker-ce-test] name=Docker CE Test - $basearch baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/$basearch/test enabled=0 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg [docker-ce-test-debuginfo] name=Docker CE Test - Debuginfo $basearch baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/debug-$basearch/test enabled=0 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg [docker-ce-test-source] name=Docker CE Test - Sources baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/source/test enabled=0 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg [docker-ce-nightly] name=Docker CE Nightly - $basearch baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/$basearch/nightly enabled=0 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg [docker-ce-nightly-debuginfo] name=Docker CE Nightly - Debuginfo $basearch baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/debug-$basearch/nightly enabled=0 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg [docker-ce-nightly-source] name=Docker CE Nightly - Sources baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/source/nightly enabled=0 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
6、清除和构建缓存
yum clean all yum makecache
7、docker配置镜像加速(在华为云镜像中心可获取自己的镜像加速配置)
8、创建镜像加速配置文件
vim /etc/docker/daemon.json
{ "registry-mirrors": [ "https://fd0cfec0ac0d446db7fd9d27e92d4a8e.mirror.swr.myhuaweicloud.com" ] }
9、重新加载配置文件,重新启动docker,查看是否配置成功
systemctl daemon-reload systemctl restart docker.service
10、docker info查看配置信息,是否配置成功镜像加速
docker info
搭建FC-web模拟器
1、拉取Flappy Bird镜像
docker pull swr.cn-north-4.myhuaweicloud.com/jeven/jsnes:1.0.0
2、检查镜像是否拉取成功
docker images
3、运行容器
docker run --restart always -p 9995:80 --name jsnes -d swr.cn-north-4.myhuaweicloud.com/jeven/jsnes:1.0.0
4、检查容器状态
docker ps
5、关闭防火墙
systemctl stop firewalld systemctl status firewalld
6、浏览器地址访问公网IP:9995
总结
华为云服务器Flexus X实例,Docker集成搭建FC-web模拟器,FC-Web 模拟器支持多款经典小游戏,如《超级马里奥》、《塞尔达传说》和《俄罗斯方块》,让玩家重温怀旧游戏乐趣,感兴趣的小伙伴可以购买华为云服务器一同搭建属于自己的游戏模拟器,目前华为云正在大促正是购买的好时候!
华为云828 Flexus X实例