# Using Liquibase via Docker

**URL:** <https://forum.liquibase.org/t/using-liquibase-via-docker/6088>\
**Category:** Community Content and Articles\
**Created:** [October 27, 2021, 3:06pm UTC](https://forum.liquibase.org/t/using-liquibase-via-docker/6088 "2021-10-27T15:06:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/liquibase1/original/2X/8/81af1ada55fb9198255cebbe394fd74740dc1429.png) [@system](https://forum.liquibase.org/u/system)\
**Post date:** [October 27, 2021, 3:06pm UTC](https://forum.liquibase.org/t/using-liquibase-via-docker/6088/1 "2021-10-27T15:06:39Z")

</div>

Originally published at: [Using Liquibase via Docker | Liquibase.com Blog](https://www.liquibase.com/blog/using-liquibase-via-docker)

Docker is super awesome for running machines that we previously used via virtual machines. But, each virtual machine requires a separate copy of the operating system. That’s a lot of space. Docker leverages the host system for the operating system to cut down on space. Docker also makes it really fast to start those machines.

We can easily start a PostgreSQL database using `docker run postgres`. This looks at the local system to see if the PostgreSQL Docker container already exists. If not, it will go to Docker Hub and download it. Neat!

We can also do the same for utilities like Liquibase. The only difference is that the Liquibase Docker container will run Liquibase and exit. Unlike a long-running server process, like PostgreSQL, it doesn’t need to be running all the time.

The value of this is that you might need to run Liquibase from a system that does not have Liquibase installed but does have Docker. [Here’s the documentation](https://hub.docker.com/r/liquibase/liquibase).

## Quick example of using Liquibase via Docker with PostgreSQL

Here’s a quick example of how to use it with PostgreSQL.

Your Liquibase _changelog_ needs to be accessible to the Docker container. So, we’ll mount the directory that holds that file with the `-v` option. Here’s the command:

```
docker run -v /home/r2/changelog:/liquibase/changelog liquibase/liquibase --driver=org.postgresql.Driver --url=”jdbc:postgresql://<DATABASE_IP>:5432/postgres” --changeLogFile=/liquibase/changelog/changelog.xml --username=postgres --password=postgres
```

The only two things you will need to change:

- Update the `/home/r2/changelog` directory to the directory that contains your _changelog_ 
- Enter the hostname/ip of your database

**Bonus fun:** If you are running PostgreSQL as a docker container, use `docker inspect <CONTAINER_NAME>` to find the IP address of your PostgreSQL database.

Let us know if you use Liquibase with Docker and run into any issues. [Here’s where to find us](https://www.liquibase.org/contact).
