在ECS节点上启动容器,安装Docker。
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install docker-ce
sudo systemctl enable docker # 设置开启自启 sudo systemctl start docker # 启动Docker
注意
开源网站的centos7.9相对于火山引擎上提供的centos镜像缺少一些工具,请使用下面的Dockerfile。
FROM docker.m.daocloud.io/centos:centos7.9.2009 RUN echo "[base]" > /etc/yum.repos.d/CentOS-Base.repo \ && echo "name=CentOS-7 - Base - mirrors.aliyun.com" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "#mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=os" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "baseurl=http://mirrors.aliyun.com/centos/7/os/\$basearch/" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "[updates]" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "name=CentOS-7 - Updates - mirrors.aliyun.com" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "#mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=updates" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "baseurl=http://mirrors.aliyun.com/centos/7/updates/\$basearch/" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "[extras]" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "name=CentOS-7 - Extras - mirrors.aliyun.com" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "#mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=extras" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "baseurl=http://mirrors.aliyun.com/centos/7/extras/\$basearch/" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "gpgcheck=1" >> /etc/yum.repos.d/CentOS-Base.repo \ && echo "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7" >> /etc/yum.repos.d/CentOS-Base.repo RUN yum -y update && yum -y groupinstall 'Development Tools' && yum install -y wget vim openssl-devel #yum -y install libffi-devel gcc openssl-devel bzip2-devel RUN yum clean all && yum makecache WORKDIR /home/work RUN wget https://www.openssl.org/source/openssl-1.1.1l.tar.gz && tar -xf openssl-1.1.1l.tar.gz && cd openssl-1.1.1l \ && ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl \ && make \ && make install RUN export LD_LIBRARY_PATH=/usr/local/openssl/lib && export CFLAGS="-I/usr/local/openssl/include" && export LDFLAGS="-L/usr/local/openssl/lib" # regionId=`curl http://100.96.0.96/latest/region_id`; curl https://emrcli-${regionId}.tos-${regionId}.ivolces.com/emrcli.sh -o emrcli.sh; chmod 755 emrcli.sh; # ./emrcli.sh install cn-beijing # docker run -dit emr:latest tail -f /dev/null
# 在dockerfile文件所在目录执行 docker build -t liubin-centos7.9:v1 # 运行 docker run -t -i liubin-centos7.9:v1 /bin/bash
说明
安装步骤与在ECS上安装EMR CLI 相同。详细操作参考:EMR 集群客户端最佳实践。