In development, we are using a dev centric docker entrypoint, one that doesn't come right out of the box
For some occassions, we may want to check if we can execute/run ./bin/docker-dev-entrypoint
ll bin
-rw-r--r-- 1 raymondgabriel staff 222B May 17 10:57 docker-dev-entrypoint
-rwxr-xr-x 1 raymondgabriel staff 223B May 6 12:49 docker-entrypoint
-rwxr-xr-x 1 raymondgabriel staff 141B Apr 19 08:25 rails
-rwxr-xr-x 1 raymondgabriel staff 90B Apr 19 08:25 rake
-rwxr-xr-x 1 raymondgabriel staff 984B Apr 19 08:25 setup
If said file had no execute access rights (x) we need to add it for the current user.
chmod +x bin/docker-dev-entrypoint
docker build -f dev.dockerfile -t rails_demo .
Advantage of this is whenever you do changes on your code, it is immediately reflected.
And to do that, we use the -v
option.
Else, you may need to stop start each time.
docker run -p 3000:3000 -v $(pwd):/rails rails_demo
docker-compose run web bin/rails db:migrate RAILS_ENV=development
docker-compose run web bin/rails console -e development