Reputation: 1518
I am getting an error saying "docker: Error response from daemon: OCI runtime create failed" when I give an argument to my Docker image in running.
My application source code follows:
require "open-uri"
require "nokogiri"
crawling_url = ARGV[0]
unless crawling_url
puts "URL to crawl is empty"
exit 1
end
puts crawling_url
page = Nokogiri.HTML(open(crawling_url))
puts page.title
And Dockerfile is:
FROM ruby:2.6
# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1
WORKDIR /usr/src/app
COPY Gemfile Gemfile.lock ./
RUN gem install bundler
RUN bundle install
COPY . .
CMD ["ruby", "/usr/src/app/crawler.rb"]
The build command I use is:
$ docker build -t crawler .
When I don't give any argument to my script, it works, but when I give one, it doesn't.
$ docker run -it crawler
URL to crawl is empty
$ docker run -it crawler "https://google.com"
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \"https://google.com\": stat https://google.com: no such file or directory": unknown.
ERRO[0001] error waiting for container: context canceled
What's wrong with it?
Upvotes: 0
Views: 276
Reputation: 1518
It worked after I changed CMD
to ENTRYPOINT
at last.
ENTRYPOINT ["ruby", "/usr/src/app/crawler.rb"]
Upvotes: 1