Skip to content

Instantly share code, notes, and snippets.

@pablotron
Created May 1, 2023 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablotron/86cb0b355ac3e4cef3b28b3e0718314d to your computer and use it in GitHub Desktop.
Save pablotron/86cb0b355ac3e4cef3b28b3e0718314d to your computer and use it in GitHub Desktop.
podman test (rootless in bookworm)
pabs@bookwormer:~/sinatra-container-test> l
app.rb Dockerfile
pabs@bookwormer:~/sinatra-container-test> cat app.rb Dockerfile
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'rubygems'
require 'sinatra'
get '/' do
'hi!'
end
FROM docker.io/ruby:3-bullseye
RUN ["gem", "install", "--no-document", "rack", "thin", "sinatra"]
COPY . /app
CMD ["ruby", "/app/app.rb", "-e", "production", "-p", "4567"]
EXPOSE 4567
pabs@bookwormer:~/sinatra-container-test> podman build -t hi .
STEP 1/5: FROM docker.io/ruby:3-bullseye
STEP 2/5: RUN ["gem", "install", "--no-document", "rack", "thin", "sinatra"]
--> Using cache 877704a1bbc919a410fd100025000419be036ea00ebcecf59d835c788919903c
--> 877704a1bbc
STEP 3/5: COPY . /app
--> Using cache 03f27ec3eb0dc0435f16fd244be1c013c14c10f83cbc81afd5b29e9a599d9c9f
--> 03f27ec3eb0
STEP 4/5: CMD ["ruby", "/app/app.rb", "-e", "production", "-p", "4567"]
--> Using cache 49833177858c903f37370f54fcd88b88dd20c8e03df72944cb6d72bf5547ecf4
--> 49833177858
STEP 5/5: EXPOSE 4567
--> Using cache a88bf49da5c1373b3df1a83be9af6297bfdcfeaa1e723fc70d0e59fc971fdd82
COMMIT hi
--> a88bf49da5c
Successfully tagged localhost/hi:latest
a88bf49da5c1373b3df1a83be9af6297bfdcfeaa1e723fc70d0e59fc971fdd82
pabs@bookwormer:~/sinatra-container-test> podman run --rm -d -p 4567:4567 hi
35aaff646142de1ed2cab82b02157ae8739b7c62adab571055b7298a5f6e245b
pabs@bookwormer:~/sinatra-container-test>
# from different machine, to verify that port is exposed
pabs@flex:~> curl http://192.168.122.156:4567/; echo
hi!
pabs@flex:~>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment