Knex migration not creating tables

Lately I’ve been trying to use knexjs with docker and I run into weird errors. When I run knex migrate:latest within the container using the command: docker exec service sh -c “knex migrate:latest”; everything works fine but the tables are not actually created in the database.

My migration:

exports.up = knex => {
  return Promise.all([
    knex.schema.createTable('users', table => { 
      table.increments('id').primary();
      table.string('name').notNullable();
      table.string('username').unique().notNullable();
      table.string('email').unique().notNullable();
      table.string('password').notNullable();
      table.datetime('created_at').notNullable();
    }),
    knex.schema.createTable('user_settings',  table => {
      table.integer('user_id');
      table.integer('xp');
    }),
  ])
}

exports.down =  knex => {
  return Promise.all([
    knex.schema.dropTable('users'),
    knex.schema.dropTable('user_settings'),
  ])
}

my Knexfile

module.exports = {
  client: 'pg',
  debug:true,
  connection: {
    host:'postgres',
    user: 'postgres',
    password: 'postgres',
    port: '',
    database: 'users'
  },
  migrations: {
    tableName: 'knex_migrations'
  }
};

I can see that the sequences knex_migrations_id_seq, knex_migrations_lock_index_seq and users_id_seq have been created.

Source: StackOverflow