docker,如何 只启动container, 不启动命令: cmd: tail -F /dev/null

database.yml 文件进行修改即可使用,连接数据库,不然会报错

如果没有这个附加命令,当

shuf
命令完成,容器将停止。
有了它,容器将保持空闲状态,这使得以后更容易连接到它(
docker exec -it container_name bash
).

tail -f /dev/null
是一个无限运行且不使用任何 CPU 的命令,因为无法从中读取任何内容
/dev/null
我们要求从中获得无尽的阅读。

Why run tail -f /dev/null to keep the container running? · Issue #201 · docker/getting-started · GitHubicon-default.png?t=M4ADhttps://github.com/docker/getting-started/issues/201

Without this additional command, when the

shuf
command is finished, the container will stop.
With it, the container will remain idle, which makes it easier to connect to it later (
docker exec -it container_name bash
).

tail -f /dev/null
is a command that runs endlessly and doesn't use any CPU because nothing can be read from
/dev/null
and we are asking for an endless read from it.

bundle exec rake db:create

使用数据库创建的时候出现报错,那么与远程数据库无法连接,查看.toos-versions

/home/linlin/.asdf/installs/ruby/2.6.9/lib/ruby/gems/2.6.0/gems/activesupport-4.2.8/lib/active_support/core_ext/object/duplicable.rb:111: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
SCRAM authentication requires libpq version 10 or above
/home/linlin/.asdf/installs/ruby/2.6.9/lib/ruby/gems/2.6.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
/home/linlin/.asdf/installs/ruby/2.6.9/lib/ruby/gems/2.6.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'

ruby 2.6.9
postgres 11.12

把数据库版本调整到10以上。

bundle

bundle exec rake db:create

还是报错

/home/linlin/.asdf/installs/ruby/2.6.9/lib/ruby/gems/2.6.0/gems/activesupport-4.2.8/lib/active_support/core_ext/object/duplicable.rb:111: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
SCRAM authentication requires libpq version 10 or above

那么,进行删除rm Gemfile.lock

vim Gemfile

取消注释 source 'https://gems.ruby-china.com'

注释#source 'https://rubygems.org'

再次进行创建

bundle exec rake db:create

/home/linlin/.asdf/installs/ruby/2.6.9/lib/ruby/gems/2.6.0/gems/activesupport-4.2.8/lib/active_support/core_ext/object/duplicable.rb:111: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.