Skip to content

Instantly share code, notes, and snippets.

@rodde177
Forked from jfear/README MongoDB Podman
Created October 16, 2020 08:20
Show Gist options
  • Save rodde177/c6e9168efc0c2f77976ddf4d0ec67b28 to your computer and use it in GitHub Desktop.
Save rodde177/c6e9168efc0c2f77976ddf4d0ec67b28 to your computer and use it in GitHub Desktop.
Setting up mongod using podman
1. Create podman container using the docker mongo image: docker.io/library/mongo:latest
`sudo podman run -d --name mongod -p 27017:27017 -v /var/lib/mongodb:/data/db:Z mongo`
2. Create service file `/etc/systemd/system/mongod.service` to run container:
```
[Unit]
Description=MongoDB Podman container
After=network.target firewalld.service
Wants=network.target
[Service]
Restart=always
ExecStart=/usr/bin/podman start -a mongod
ExecStop=/usr/bin/podman stop -t 10 mongod
[Install]
WantedBy=multi-user.target
```
3. start container:
```
systemctl start mongod.service
systemctl enable mongod.service
```
4. Restore data to database:
`podman run -it --rm -v $HOME/Downloads/sra:/tmp/sra:Z --network=host mongo mongorestore -d sra -c ncbi --gzip /tmp/sra/ncbi.bson.gz`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment