Skip to content

Docker documentation #182

@samikeijonen

Description

@samikeijonen

There are some documentation how to get Docker up and running in docker-compose.yml file. But here is a summary what steps have we done to make Docker work.

Maybe using Docker should be documented better at Seravo docs.

Bring latest updates from Seravo stack

If you have older project, first step is the get all the updates from Seravo stack to your project.

Create .env file

  • Create .env file in the root of the project.
  • Add line SITE=[project_name] to the .env file.
  • Remember to change [project_name] for real project name which should match name in config.yml file.
  • By default [project_name] is wordpress.

Add port bindings

Add port bindings in docker-compose.yml file:

Currently:

    ports:
    - 80
    - 443
    - 22

Added port bindings:

    ports:
    - 80:80
    - 443:443
    - 22:22

Update hosts file

Local URL for the project needs to be added manually in the /etc/hosts file by adding line:

127.0.0.1 [project_name].local

Once again remember to change [project_name] for the real project name.

Start Docker

Start Docker by running docker-compose up.

If everything worked you should be able to access [project_name].local URL in the browser.

Clean up

Sometimes clean up is needed, it can be done with these commands:

docker-compose down -v --remove-orphans
rm -rf .vagrant

How to access Docker container

Accessing Docker container is needed for running WP CLI commands for example.

docker-compose exec --user vagrant wordpress bash

--user vagrant is needed in order to have privileges to run commands like wp-pull-production-db.

If above does not work, try accessing using container ID.

  1. Get container ID: docker ps.
  2. Access: docker exec -it --user vagrant {ID} sh
  3. Or using bash: docker exec -it --user vagrant {ID} bash

Remember to change {ID} for the actual ID.

Summary

There are extra manual steps to take when using Docker. Maybe in the long run some of these can be automated. Like adding port bindings by default?

Anyways we wanted to share our findings and how we have started using Docker.

We have at least tested with macOS Big Sur and WIN 10 with WSL2 system.

cc: @elguitar

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfeature-dockerIssues related to the Docker development environment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions