Containerfile usage: Difference between revisions

From wikinotes
(Created page with "= Basics = <blockquote> <syntaxhighlight lang="bash"> # build image from Containerfile # `sudo podman images` podman build -f path/Containerfile -t ${IMAGE_NAME} # build container form image podman run \ --name ${CONTAINER_NAME} `# podman ps` \ -v /home/progs:/progs `# mount /home/progs in container as /progs` \ -p 80:8080 `# expose container port 80 as 8080 on host` \ -ti ${IMAGE_NAME} /bin/bash # use container sudo podman star...")
 
No edit summary
Line 1: Line 1:
= Documentation =
<blockquote>
{| class="wikitable"
|-
| podman commands || https://docs.podman.io/en/latest/Commands.html
|-
|}
</blockquote><!-- Documentation -->
= Basics =
= Basics =
<blockquote>
<blockquote>

Revision as of 13:32, 10 April 2023

Documentation

podman commands https://docs.podman.io/en/latest/Commands.html

Basics

# build image from Containerfile   # `sudo podman images`
podman build -f path/Containerfile -t ${IMAGE_NAME}

# build container form image
podman run \
    --name ${CONTAINER_NAME}   `# podman ps` \
    -v /home/progs:/progs      `# mount /home/progs in container as /progs` \
    -p 80:8080                 `# expose container port 80 as 8080 on host` \
    -ti ${IMAGE_NAME} /bin/bash

# use container
sudo podman start ${CONTAINER_NAME}               # run created container
sudo podman exec -ti ${CONTAINER_NAME} /bin/bash  # attach to started container