If we specify single port in dockerfile or docker-compose file like below
sshd:
build: ./backend/mock/sshd
volumes:
- ./docker/sftp_upload_dir:/root/upload_dir
ports:
- '22'. #<----------
and use the docker-compose file with nerdctl using command
nerdctl compose up
then nerdctl command will exit with following error
FATA[0000] unsupported port number: 0
As per docker documentation https://docs.docker.com/compose/compose-file/compose-file-v3/#ports
Thus 0 is chosen as the host port which creates error, so solution is to explicitly specify host port as below
Note that I have explicitly added
22:
before22
in the last line to make it work withnerdctl
. It works by default with docker-compose up.