-
-
Notifications
You must be signed in to change notification settings - Fork 725
Docker: useful tips and commands
After setting up your docker environment you need to know how to go about doing things, here's some help.
If you dont want to run docker as root: https://docs.docker.com/engine/install/linux-postinstall/
EXEC vs RUN Note that there is a difference between exec/run. Run boots any required containers while exec expects a docker-compose run to happen beforehand. If you execute commands using run you'll end up with trillions of running containers 💥
We use letter_opener to automatically opens up emails in your browser, but that doesn’t work in a virtual environment, so you may see these errors in your console:
openfoodnetwork-worker-1 | /usr/bin/xdg-open: 869: Couldn't find a suitable web browser!
openfoodnetwork-worker-1 | Set the BROWSER environment variable to your desired browser.
There are a few options you can try, see https://github.com/ryanb/letter_opener#remote-alternatives or https://www.youtube.com/watch?v=Ubrr9mqE94o. Feel free to submit a PR if you have a solution!
To run any of these commands, you need a container running first, so you should do this first:
sudo docker compose up --build
To run the containers in detached mode, so that you don't see the server log, you can just the -d flag:
sudo docker compose up -d
-
How to have a bash interface inside the container?
sudo docker compose exec web bash
-
How to run a command inside the container?
sudo docker compose exec web bash -c 'bundle install'
-
How to run karma tests inside the container:
sudo docker compose exec web bash -c 'bundle exec rake karma:start'
-
How to access the database that the web container is using?
docker compose exec db psql -U ofn -d open_food_network_dev
Development environment setup
- Pipeline development process
- Bug severity
- Feature template (epic)
- Internationalisation (i18n)
- Dependency updates
Development
- Developer Guidelines
- The process of review, test, merge and deploy
- Making a great commit
- Making a great pull request
- Code Conventions
- Database migrations
- Testing and Rspec Tips
- Automated Testing Gotchas
- Rubocop
- Angular and OFN
- Feature toggles
- Stimulus and Turbo
Testing
- Testing process
- OFN Testing Documentation (Handbooks)
- Continuous Integration
- Parallelized test suite with knapsack
- Karma
Releasing
Specific features
Data and APIs
Instance-specific configuration
External services
Design