OS
RHEL-7.7_HVM-20190923-x86_64-0-Hourly2-GP2
yum install yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
ls /etc/yum.repos.d/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
有効化するとこうなる
# yum-config-manager --enable rhui-rhel-7-server-rhui-extras-rpms
# yum repolist all | grep extras
rhui-rhel-7-server-rhui-extras-debug-rpms/x86_64 disabled
rhui-rhel-7-server-rhui-extras-rpms/x86_64 enabled: 1,413
rhui-rhel-7-server-rhui-extras-source-rpms/x86_64 disabled
※↑これをしないと有効化が必要なのでエラーになる
# yum install docker-ce-18.06.1.ce-3.el7
Loaded plugins: amazon-id, search-disabled-repos
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 0:18.06.1.ce-3.el7 will be installed
--> Processing Dependency: container-selinux >= 2.9 for package: docker-ce-18.06.1.ce-3.el7.x86_64
--> Finished Dependency Resolution
Error: Package: docker-ce-18.06.1.ce-3.el7.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2.9
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
yum install docker-ce-18.06.1.ce-3.el7
docker --version
systemctl status docker
systemctl start docker
getent group | grep docker
docker run hello-world
aws ecr get-login-password --region region | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.comdocker
sudo vi Dockerfile
/Dockerfile
FROM ubuntu:18.04
# Install dependencies
RUN apt-get update && \
apt-get -y install apache2
# Install apache and write hello world message
RUN echo 'Hello World!' > /var/www/html/index.html
# Configure apache
RUN echo '. /etc/apache2/envvars' > /root/run_apache.sh && \
echo 'mkdir -p /var/run/apache2' >> /root/run_apache.sh && \
echo 'mkdir -p /var/lock/apache2' >> /root/run_apache.sh && \
echo '/usr/sbin/apache2 -D FOREGROUND' >> /root/run_apache.sh && \
chmod 755 /root/run_apache.sh
EXPOSE 80
CMD /root/run_apache.sh
docker build -t hello-world .
docker images --filter reference=hello-world
docker tag hello-world:latest aws_account_id.dkr.ecr.region.amazonaws.com/hello-world:latest
docker push aws_account_id.dkr.ecr.region.amazonaws.com/hello-world:latest