Difference between revisions of "Podman"

From John Freier
Jump to: navigation, search
Line 32: Line 32:
  
 
'''Pull MongoDB'''
 
'''Pull MongoDB'''
   podman run -d -p 27017:27017 -v mongo-data:/data/db --name some-mongo mongo:5.0.6
+
   podman run \
 +
    --detach \ # -d Detached mode: run the container in the background and print the new container ID. The default is false
 +
    --publish 27017:27017 # -p Publish a container’s port, or range of ports, to the host.
 +
    --userns=keep-id \ # Because podman runs rootless we need to assign a user that can access the local volumn.  This sets the podman user to the same user who ran the podman command.
 +
    --volume ./mongo-data:/data/db \ # -v Create a bind mount.
 +
    --name some-mongo \ # Assign a name to the container.
 +
    mongo:4.4.13 # The image to run.

Revision as of 08:43, 7 April 2022

List Images

 podman images

List running images

 podman ps

Pull an image

 podman pull docker.io/library/httpd

Run an image

 podman run -dt -p 8080:80/tcp docker.io/library/httpd

View Logs

 podman logs ff22b3bfecc1

Stop the latest container

 podman stop ff22b3bfecc1

List all containers

 podman ps -a

Remove Container

 podman rm ff22b3bfecc1

Load an Image

 Worked
 cat cs-oci.tar | podman load
 
 Did not work.
 podman load oci-archive:cs-oci.tar:latest

Pull MongoDB

 podman run \ 
   --detach \ # -d Detached mode: run the container in the background and print the new container ID. The default is false
   --publish 27017:27017 # -p Publish a container’s port, or range of ports, to the host.
   --userns=keep-id \ # Because podman runs rootless we need to assign a user that can access the local volumn.  This sets the podman user to the same user who ran the podman command.
   --volume ./mongo-data:/data/db \ # -v Create a bind mount.
   --name some-mongo \ # Assign a name to the container.
   mongo:4.4.13 # The image to run.