/** * Add a TCP container port that should be bound to a fixed port on the docker host. * <p> * Note that this method is protected scope to discourage use, as clashes or instability are more likely when * using fixed port mappings. If you need to use this method from a test, please use {@link FixedHostPortGenericContainer} * instead of GenericContainer. * * @param hostPort * @param containerPort */ protected void addFixedExposedPort(int hostPort, int containerPort) { addFixedExposedPort(hostPort, containerPort, InternetProtocol.TCP); }
/** * Bind a fixed port on the docker host to a container port * @param hostPort a port on the docker host, which must be available * @param containerPort a port in the container * @param protocol an internet protocol (tcp or udp) * @return this container */ public SELF withFixedExposedPort(int hostPort, int containerPort, InternetProtocol protocol) { super.addFixedExposedPort(hostPort, containerPort, protocol); return self(); } }
/** * Bind a fixed port on the docker host to a container port * @param hostPort a port on the docker host, which must be available * @param containerPort a port in the container * @param protocol an internet protocol (tcp or udp) * @return this container */ public SELF withFixedExposedPort(int hostPort, int containerPort, InternetProtocol protocol) { super.addFixedExposedPort(hostPort, containerPort, protocol); return self(); } }
addFixedExposedPort(hostPort, containerPort, InternetProtocol.TCP);