- add container sources to download from
echo "unqualified-search-registries = ['docker.io', 'ghrc.io', 'quay.io']" > .config/containers/registries.conf
- search container
podman search busybox
- download container
podman pull docker.io/library/busybox
- run container
podman run -it 9211bbaa0dbd
- show all running containers:
podman ps
- show all containers:
podman ps -a
- download nginx
podman pull docker.io/library/nginx
- run custom nginx
podman run --name pdm-nginx -p 8080:80 nginx
container name: --name pdm-nginx
-p 8080:80: map containers 80 port to localhost 8080 port
nginx: image name to build container
- inspect container
podman inspect pdm-nginx
- create a node script in a folder:
mkdir -p /home/projects/pdm-node
cd /home/projects/pdm-node
nano index.js
const http = require('http');
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end('Hello, podman');
});
const port = 8080;
server.listen(port, () => {
console.log(`Server running at http://localhost:${port}/`);
});
- create Dockerfile
FROM node:18
WORKDIR /app
COPY index.js .
EXPOSE 8080
CMD ["node", "index.js"]
- build the custom image
podman build -t pdm-node .
- run custom image
podman run --name pdm-node -p 8080:8080 pdm-node:latest
- stop custom image
podman ps
podman CONTAINERID stop
- start custom image
podman start pdm-node
-
register to docker hub: https://hub.docker.com
-
login docker hub:
podman login docker.io
- build image to upload
podman build -t zital/pdm-node .
- show the new image in image listen
podman images
- publish image to docker.io
podman push zital/pdm-node
- check the image published online
https://hub.docker.com/r/zital/pdm-node
- search image in repository
podman search pdm-node
- pod help
podman pod --help
- podman create pod
podman pod create --name pdm-node-pod
- podman list pods:
podman pod ls
- list all containers including pods: there is a "pause" default container inside the empty pod
podman ps -a --pod
- add container to pod
podman run -dt --pod pdm-node-pod pdm-node
- check the container inside the pod
podman ps -a --pod
- stop container inside the pod
podman stop vibrant_goldwasser
- check it in the list
podman ps --pod
- start the container
podman start vibrant_goldwasser
- check it in the list
podman ps --pod
- remove container inside the pod
podman rm vibrant_goldwasser
- because of the container is running, we can remove it
podman stop vibrant_goldwasser
- remove container inside the pod
podman rm vibrant_goldwasser
- show all containers
podman ps -a --pod
- list pods
podman pod ls
- stop a pod
podman pod stop pdm-node-pod
- list pods
podman pod ls
- start pod
podman pod start pdm-node-pod
- stop pod
podman pod stop pdm-node-pod
- remove pod
podman pod rm pdm-node-pod
- create a pod
podman pod create --name pdm-node-pod
- add container to pod
podman run -dt --pod pdm-node-pod pdm-node
- check it
podman pod ls
- create kurbenetes YAML manifest config file
podman generate kube pdm-node-pod > pdm-node.yml
- delete pod
podman pod stop pdm-node-pod
podman pod rm pdm-node-pod
- create pod via kurbenetes config file
podman play kube pdm-node.yml
- list pods
podman ps --pod
- test url
curl localhost:8080
golang node-gatik aldatu dot
Iturria: https://www.youtube.com/watch?v=YXfA5O5Mr18