Docker: Hello world
12 October 2023 (Updated 12 October 2023)
Create a Dockerfile
Create a Dockerfile to specify your app’s dependencies and the
# Use the official Ruby image from the DockerHub
CMD ["ruby", "./your_script.rb"]
FROM ruby:3.2-slim
# Set the working directory in Docker
WORKDIR /app
# Copy the content of the local src directory to the working directory
COPY . .
# Specify the command to run on container start
CMD ["ruby", "./hello-docker.rb"]
Create image from Dockerfile
docker build -t hello-world-ruby .
Start container from image
docker run hello-world-ruby
Tagged:
Docker
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment