Docker2rootless: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==docker2rootless== <syntaxhighlight lang="bash"> ####### BEGIN USEFULL CODE ######## image= export REGISTRY_FQDN_DST= ####### END USEFULL CODE ######## (apt install podman...") |
No edit summary |
||
Line 7: | Line 7: | ||
####### END USEFULL CODE ######## | ####### END USEFULL CODE ######## | ||
apt install podman podman-docker -y ||yum install podman podman-docker -y | |||
systemctl start podman.socket | systemctl start podman.socket | ||
cat << EOT>Dockerfile | cat << EOT>Dockerfile | ||
Line 23: | Line 23: | ||
podman build -t ${image} . |tee /tmp/${image}.build | podman build -t ${image} . |tee /tmp/${image}.build | ||
podman login ${REGISTRY_FQDN_DST} | podman login ${REGISTRY_FQDN_DST} | ||
podman push ${image} ${REGISTRY_FQDN_DST}/${image} | podman push ${image} ${REGISTRY_FQDN_DST}/${image} | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 09:00, 10 January 2023
docker2rootless
####### BEGIN USEFULL CODE ########
image=
export REGISTRY_FQDN_DST=
####### END USEFULL CODE ########
apt install podman podman-docker -y ||yum install podman podman-docker -y
systemctl start podman.socket
cat << EOT>Dockerfile
FROM ${image}
USER root
####### BEGIN USEFULL CODE ########
####### END USEFULL CODE ########
RUN grep -rlw http /etc |while read i ;do sed -ri 's#\b80\b#8080#' \${i} ; sed -ri 's#\b443\b#6443#' \${i} ;done
RUN find / -xdev -exec chmod -f -c g=u {} \; -exec chown -f -c 1001:root {} \; >/dev/null 2>&1
RUN grep -w 1001 /etc/passwd ||echo "rootless:x:1001:0:rootless:/root:/bin/bash" >>/etc/passwd
USER 1001
EOT
podman rmi -f ${image}
podman build -t ${image} . |tee /tmp/${image}.build
podman login ${REGISTRY_FQDN_DST}
podman push ${image} ${REGISTRY_FQDN_DST}/${image}