Skip to content

Commit

Permalink
docs: add additional commands
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlo-myskov committed Nov 15, 2023
1 parent f56f489 commit c65457c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 25 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -967,10 +967,6 @@ ALLOWED_HOSTS.extend(
# -d flag allows to run the containers in the background, so that we can see the output of the containers
$ docker-compose -f docker-compose-deploy.yml up -d
```
- Rebuild and run services (if you've made any changes to the project)
```bash
$ docker-compose -f docker-compose-deploy.yml up -d --build
```
- Open the browser and go to the **Public IPv4 DNS** address of the EC2 instance

[Back to top ↑](#recipe-api)
Expand Down
58 changes: 37 additions & 21 deletions commands.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
# Useful Commands
## EC2 Instance
- Connect to the EC2 instance
```bash
$ ssh ec2-user@<public_ipv4_address>
```
- Build the docker image based on specific docker compose file
```bash
$ docker-compose -f docker-compose-deploy.yml build
```
- Run the docker containers based on specific docker compose file
```bash
$ docker-compose -f docker-compose-deploy.yml up
```
- Rebuild and run the docker containers based on specific docker compose file
```bash
$ docker-compose -f docker-compose-deploy.yml up --build
```
- Rebuid the specific service based on the specific docker compose file if you made changes to project files and pulled them from GitHub
```bash
$ docker-compose -f docker-compose-deploy.yml build <service_name>
```
- Restart the specific service based on the specific docker compose file after you rebuid it
```bash
$ docker-compose -f docker-compose-deploy.yml up --no-deps -d <service_name>
# --no-deps - don't restart dependent services (ngix, postgres) since we only want to restart the service we rebuid
```
- Remove volumes of specific docker-compose.yml file
```bash
$ docker-compose -f docker-compose-deploy.yml down --volumes
```
- Check logs of the container on production
```bash
$ docker-compose -f docker-compose-deploy.yml logs
```

## Docker
- Start Docker Daemon
```bash
$ sudo service docker start
Expand All @@ -11,26 +47,14 @@ $ docker build .
```bash
$ docker compose build
```
- Build the docker image based on specific docker compose file
```bash
$ docker compose -f docker-compose-deploy.yml build
```
- Rebuild the docker image
- Rebuild the docker images
```bash
$ docker compose up --build
```
- Run the docker containers based on docker-compose.yml file
```bash
$ docker compose up
```
- Run the docker containers based on specific docker compose file
```bash
$ docker compose -f docker-compose-deploy.yml up
```
- Rebuild and run the docker containers based on specific docker compose file
```bash
$ docker compose -f docker-compose-deploy.yml up --build
```
- Check images
```bash
$ docker images
Expand Down Expand Up @@ -59,14 +83,6 @@ $ docker volume ls
```bash
$ docker volume rm <volume_name>
```
- Remove volumes of specific docker-compose.yml file
```bash
$ docker-compose -f docker-compose-deploy.yml down --volumes
```
- Check logs of the container on production
```bash
$ docker-compose -f docker-compose-deploy.yml logs
```

## Run commands inside the container
- Using `docker compose run` command
Expand Down

0 comments on commit c65457c

Please sign in to comment.